.then(res => …)await

Hattrick

Code analysis and research, right in your pull request.

Review details

Claims bypass delayed retry scheduling.

Queued retries remain immediately claimable despite their future run_at, defeating backoff and potentially creating hot retry loops during outages.

Recommendation: Add run_at <= clock_timestamp() before the state predicate and test that future jobs cannot be claimed.

A stale worker can complete a replacement worker's job.

After lease expiry and reclamation, the original worker can return and mark the row completed because completion does not verify ownership or expiry.

Recommendation: Add owner and unexpired-lease predicates, pass leaseOwner, and test the two-worker expiry race.

Captured directly from GitHub. Cropped only; text and styling are unchanged. Original on GitHub (private repository)