UrlDiscoveredListener: add tries and failed() handler #20

Closed
opened 2026-04-26 03:53:33 +02:00 by myrmidex · 0 comments
Owner

Context

App\Listeners\UrlDiscoveredListener implements ShouldQueue but has no $tries or failed() method. Default Laravel behavior on the production queue is effectively unlimited retries on transient failures.

Combined with the absence of unique-violation handling in firstOrCreate under concurrent listener execution (two workers racing on the same URL), a transient PG hiccup can trigger a retry storm with no audit trail.

Goal

Bound the retry count and add observability for permanent failures.

Acceptance criteria

  • public int $tries = 3; (or similar) on the listener.
  • public function failed(UrlDiscovered $event, Throwable $e): void that logs the event payload identity (instance_id, url, postUrl) plus the exception class and message at warning level.
  • A new test asserting that after exhausting retries, failed() is invoked with the right shape. Use Bus::fake() or queue-driver inspection.
  • Existing UrlDiscoveryTest tests still pass.

Out of scope

  • Dead-letter queue inspection tooling (separate ticket if needed).
  • Different retry strategies (exponential backoff, etc.).
## Context `App\Listeners\UrlDiscoveredListener` implements `ShouldQueue` but has no `$tries` or `failed()` method. Default Laravel behavior on the production queue is effectively unlimited retries on transient failures. Combined with the absence of unique-violation handling in `firstOrCreate` under concurrent listener execution (two workers racing on the same URL), a transient PG hiccup can trigger a retry storm with no audit trail. ## Goal Bound the retry count and add observability for permanent failures. ## Acceptance criteria - `public int $tries = 3;` (or similar) on the listener. - `public function failed(UrlDiscovered $event, Throwable $e): void` that logs the event payload identity (instance_id, url, postUrl) plus the exception class and message at warning level. - A new test asserting that after exhausting retries, `failed()` is invoked with the right shape. Use `Bus::fake()` or queue-driver inspection. - Existing UrlDiscoveryTest tests still pass. ## Out of scope - Dead-letter queue inspection tooling (separate ticket if needed). - Different retry strategies (exponential backoff, etc.).
myrmidex added this to the v0.2 milestone 2026-04-26 03:53:33 +02:00
myrmidex self-assigned this 2026-04-26 03:53:34 +02:00
myrmidex added the
enhancement
label 2026-05-01 01:01:59 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lvl0/trove#20
No description provided.