feat: add per-event retry and backoff for queued broadcasts - #1529
Merged
Conversation
Implements queue.JobWithShouldRetry on BroadcastJob using the event's BroadcastTries/BroadcastBackoff captured at dispatch time. Broadcasts without BroadcastTries remain single-shot regardless of the worker's tries config.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1529 +/- ##
==========================================
- Coverage 69.81% 69.79% -0.02%
==========================================
Files 396 409 +13
Lines 30761 31344 +583
==========================================
+ Hits 21476 21877 +401
- Misses 8278 8435 +157
- Partials 1007 1032 +25 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Aug 2, 2026
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
BroadcastTries()sets the maximum attempts andBroadcastBackoff()sets the delay before each retry.BroadcastJobnow implementsqueue.JobWithShouldRetry, so retries are driven by the event's own policy instead of the queue worker's global tries config; broadcasts withoutBroadcastTriesremain single-shot.ShouldBroadcastWithTries/ShouldBroadcastWithBackoffoptional event interfaces (with regenerated mocks) so the retry policy is captured at dispatch time and enforced at execution time.Why
Previously a queued broadcast's retry behavior was fixed by the queue worker's global tries setting, giving every broadcast job the same retry count and no way to schedule per-attempt delays. This made transient driver failures (e.g. a briefly-unavailable Pusher/Redis connection) hard to handle: either everything retried aggressively or nothing did, with no backoff between attempts.
This change lets each broadcast event opt into its own retry policy at the dispatch site, mirroring how Goravel already lets events control their queue, connections, delay, timeout, and sync/async behavior. Backoff is applied per attempt with the last value repeating, matching Laravel's
backoffsemantics. Events that do not implement the new interfaces keep the existing single-shot behavior, so this is fully backward compatible.