test: add release-based queue retry example (framework#1531) - #139
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TestRetryablefails the first two attempts and succeeds on the third.goravel/frameworktoc0b610bso the database queue driver preserves sub-second backoff delays (time.Time.Add) and the jobs-table migration storesreserved_at/available_at/created_atwith millisecond precision (DateTimeTz(col, 3)); the broadcast backoff test now asserts real 100ms/200ms delays instead of whole-second stand-ins.retry_afterto thedatabase,redis1, andredisqueue connections so a crashed worker's reservation expires and the job is recovered by other workers, and cover the retry-exhausted path viaTestReleaseBasedRetryExhausted, which lands the job infailed_jobsonceShouldRetrygives up.Why
Goravel's queue now supports release-based retries: when a job implements
queue.JobWithShouldRetryand fails, it is released back to the queue with its attempt count preserved instead of being retried purely in-process, so retries survive worker restarts and can be picked up by any worker. The example repo consumes the framework changes that enable this, declares theretry_afterreservation-expiry window required by the drivers, and demonstrates the flow with a job that fails the first two attempts and succeeds on the third — while also proving the exhausted path lands the job infailed_jobs.Sub-second backoff now works end to end: the framework's database driver keeps the full delay (
time.Time.Add) and the jobs table storesavailable_atwith millisecond precision, so the earlier whole-second workaround was reverted and the tests exercise the real 100ms/200ms delays. The example migration matches the framework stub so the reference is copy-safe for production databases, and the self-pinreplacedirective forgoravel/frameworkingo.modis restored so the example consistently builds against the framework revision it demonstrates.