SIGN IN SIGN UP

feat: add robustness improvements to PrismaQueue

- Auto-reclaim stale jobs: new `staleTimeout` option (default 30 min)
  periodically calls `requeueStale` inside the poll loop (non-transactional
  mode only; no-op in transactional mode where crashes roll back the claim)
- Claim-time maxAttempts enforcement: jobs already over budget are finalized
  immediately without running the worker, preventing zombie jobs after
  repeated hard crashes
- Atomic reschedule in transactional mode: next occurrence is enqueued
  inside the dequeue transaction via the new `#enqueueWithClient` helper,
  so completion and reschedule commit together or roll back together
- Drain-resolver stop(): replaces the 100ms busy-wait loop with a
  promise resolved the instant `concurrency` reaches 0, bounded by the
  existing `timeout` option
- Probe-based poll: removes the pre-COUNT `size()` query; the dequeue
  UPDATE itself returns nothing on an empty queue, so the poll simply
  spawns probes up to the available slots
- `maxRetryDelay` option: configures the ceiling for the default
  exponential-backoff retry strategy
- Loud defaults: `error` and `jobError` events now also call
  `console.error` so failures are visible without DEBUG enabled

Add a "PrismaQueue (robustness)" test suite covering all five scenarios:
claim-time enforcement, auto-reclaim lease, idempotent reschedule, loud
failures, and stop() draining.
O
Olivier Louvignes committed
4cd884415c870159e6f2eef220389ca4e276fdf8
Parent: f2d142a