Skip to content

Commit 683154a

Browse files
authored
Fixes report_after_job_retries for retry: 0 (#1557)
* Fixes report_after_job_retries for retry: 0 * Updates CHANGELOG.md * Updates changelog release to 4.7.1
1 parent 9e964c4 commit 683154a

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 4.7.1
2+
3+
### Bug Fixes
4+
- Send events when report_after_job_retries is true and a job is configured with retry: 0 [#1557](https://github.com/getsentry/sentry-ruby/pull/1557)
5+
- Fixes [#1556](https://github.com/getsentry/sentry-ruby/issues/1556)
6+
17
## 4.7.0
28

39
### Features

sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def call(ex, context)
1313

1414
retry_option = context.dig(:job, "retry")
1515

16-
if Sentry.configuration.sidekiq.report_after_job_retries && retry_option.is_a?(Integer)
16+
if Sentry.configuration.sidekiq.report_after_job_retries && retry_option.is_a?(Integer) && retry_option.positive?
1717
retry_count = context.dig(:job, "retry_count")
1818
if retry_count.nil? || retry_count < retry_option - 1
1919
return

sentry-sidekiq/spec/sentry/sidekiq_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@
114114
expect(transport.events.count).to eq(1)
115115
expect(retry_set.count).to eq(1)
116116
end
117+
118+
it "doesn't affect jobs with zero retries" do
119+
execute_worker(processor, ZeroRetryWorker)
120+
121+
expect(transport.events.count).to eq(1)
122+
end
117123
end
118124

119125
context "when tracing is enabled" do

sentry-sidekiq/spec/spec_helper.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,16 @@ def perform
143143
end
144144
end
145145

146+
class ZeroRetryWorker
147+
include Sidekiq::Worker
148+
149+
sidekiq_options retry: 0
150+
151+
def perform
152+
1/0
153+
end
154+
end
155+
146156
def execute_worker(processor, klass)
147157
klass_options = klass.sidekiq_options_hash || {}
148158
options = {}

0 commit comments

Comments
 (0)