Skip to content

fix(sidekiq): Report error when retry limit is below attempt_threshold#2940

Merged
sl0thentr0py merged 2 commits into
getsentry:masterfrom
marcboquet:attempt-threshold-cap
May 4, 2026
Merged

fix(sidekiq): Report error when retry limit is below attempt_threshold#2940
sl0thentr0py merged 2 commits into
getsentry:masterfrom
marcboquet:attempt-threshold-cap

Conversation

@marcboquet
Copy link
Copy Markdown
Contributor

Description

Fix #2939

The attempt_threshold (added in #2503) has a bug when a job's retry option is lower than its attempt_threshold (e.g. retry: 1 with attempt_threshold: 3).

In those cases the error handler skipped every attempt and the job was silently dropped.

This PR caps the threshold at the job's final attempt so these jobs still report before entering the dead set. Jobs whose retry count meets or exceeds the threshold behave exactly as before.

@sdk-maintainer-bot
Copy link
Copy Markdown

This PR has been automatically closed. The referenced issue does not show a discussion between you and a maintainer.

To avoid wasted effort on both sides, please discuss your proposed approach in the issue first and wait for a maintainer to respond before opening a PR.

Please review our contributing guidelines for more details.

When a job's `retry` option is lower than its `attempt_threshold` (e.g.
`retry: 1` with `attempt_threshold: 3`), the error handler skipped every
attempt and the job was silently dropped — it died before ever reaching
the threshold.

Cap the threshold at the job's final attempt so these jobs still report
before entering the dead set. Jobs whose retry count meets or exceeds
the threshold behave exactly as before.
@sl0thentr0py sl0thentr0py force-pushed the attempt-threshold-cap branch from e36501f to 180fe75 Compare May 4, 2026 11:08
Copy link
Copy Markdown
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx @marcboquet and apologies for the bot auto-close!

@sl0thentr0py sl0thentr0py merged commit 89514c0 into getsentry:master May 4, 2026
134 of 135 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.55%. Comparing base (7d10c02) to head (e7737eb).
⚠️ Report is 73 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2940      +/-   ##
==========================================
+ Coverage   90.13%   90.55%   +0.41%     
==========================================
  Files         132      142      +10     
  Lines        5301     5630     +329     
==========================================
+ Hits         4778     5098     +320     
- Misses        523      532       +9     
Components Coverage Δ
sentry-ruby 97.27% <97.97%> (-0.02%) ⬇️
sentry-rails 55.35% <20.00%> (-0.15%) ⬇️
sentry-sidekiq 95.84% <100.00%> (+0.79%) ⬆️
sentry-resque 94.44% <ø> (ø)
sentry-delayed_job 94.68% <ø> (ø)
sentry-opentelemetry 99.56% <100.00%> (+0.25%) ⬆️
Files with missing lines Coverage Δ
sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb 97.56% <100.00%> (+5.25%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The attempt_threshold option in sentry-sidekiq will silently drop jobs with low retry count

2 participants