Skip to content

feat: Add queue failer#1057

Merged
hwbrzzl merged 3 commits intomasterfrom
bowen/queue-failer
Jun 2, 2025
Merged

feat: Add queue failer#1057
hwbrzzl merged 3 commits intomasterfrom
bowen/queue-failer

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Jun 1, 2025

📑 Description

✅ Checks

  • Added test cases for my code

@hwbrzzl hwbrzzl marked this pull request as ready for review June 2, 2025 10:24
Copilot AI review requested due to automatic review settings June 2, 2025 10:24
@hwbrzzl hwbrzzl requested a review from a team as a code owner June 2, 2025 10:24
@codecov
Copy link

codecov bot commented Jun 2, 2025

Codecov Report

Attention: Patch coverage is 96.38554% with 3 lines in your changes missing coverage. Please review.

Project coverage is 71.28%. Comparing base (5d8859e) to head (621f53c).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
queue/application.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1057      +/-   ##
==========================================
+ Coverage   71.23%   71.28%   +0.04%     
==========================================
  Files         180      181       +1     
  Lines       12705    12723      +18     
==========================================
+ Hits         9051     9070      +19     
  Misses       3264     3264              
+ Partials      390      389       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new queue failer feature to handle failed jobs, allowing the system to retrieve and retry them. Key changes include:

  • Introducing the Failer implementation in queue/failer.go.
  • Modifying test files and mocks to remove redundant empty slice initializations.
  • Updating the Queue interface and related methods to incorporate the new Failer functionality.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
queue/worker_test.go Removed unnecessary empty slice initializations from tests.
queue/utils/convert_test.go Removed unused empty Chain fields in tests.
queue/utils/convert.go Changed slice building approach by using append instead of preassign.
queue/failer.go Added new Failer struct and methods for managing failed jobs.
queue/driver_database_test.go Cleaned up test code by removing redundant empty slice initializers.
queue/console/queue_retry_command.go Updated job retry logic to use Failer and simplified flow.
queue/application.go Added Failer() method and reordered JobStorer() for clarity.
mocks/queue/Queue.go Updated mocks to remove now-obsolete GetJobStorer methods.
mocks/queue/Failer.go New mock implementations for the Failer interface.
mocks/queue/FailedJob.go New mock implementations for the FailedJob interface.
contracts/queue/queue.go Modified queue contract to include Failer and update JobStorer.
contracts/queue/failer.go Added contracts for Failer and FailedJob interfaces.

func TaskToJson(task contractsqueue.Task, json foundation.Json) (string, error) {
chain := make([]Job, len(task.Chain))
for i, taskData := range task.Chain {
var chain []Job
Copy link

Copilot AI Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider preallocating the 'chain' slice using make([]Job, 0, len(task.Chain)) to avoid potential reallocations when appending and improve performance.

Suggested change
var chain []Job
chain := make([]Job, 0, len(task.Chain))

Copilot uses AI. Check for mistakes.
@hwbrzzl hwbrzzl merged commit 8f5d174 into master Jun 2, 2025
14 checks passed
@hwbrzzl hwbrzzl deleted the bowen/queue-failer branch June 2, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants