Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

If you were using the `SpanProcessor` before, we recommend migrating over to `config.otlp` since it's a much simpler setup.

- Treat Sidekiq nil retry as true ([#2864](https://github.com/getsentry/sentry-ruby/pull/2864))

### Bug Fixes

- Fix `MetricEvent` timestamp serialization to float ([#2862](https://github.com/getsentry/sentry-ruby/pull/2862))
Expand Down
4 changes: 2 additions & 2 deletions sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def call(ex, context, sidekiq_config = nil)
def retryable?(context)
retry_option = context.dig(:job, "retry")
# when `retry` is not specified, it's default is `true` and it means 25 retries.
retry_option == true || (retry_option.is_a?(Integer) && retry_option.positive?)
retry_option.nil? || retry_option == true || (retry_option.is_a?(Integer) && retry_option.positive?)
end

# @return [Integer] the number of retries allowed for the job
Expand All @@ -73,7 +73,7 @@ def retry_limit(context, sidekiq_config)
case limit
when Integer
limit
when TrueClass
when TrueClass, NilClass
max_retries =
if WITH_SIDEKIQ_7
# Sidekiq 7.1.5+ passes the config to the error handler, so we should use that.
Expand Down
18 changes: 18 additions & 0 deletions sentry-sidekiq/spec/sentry/sidekiq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,24 @@ def retry_last_failed_job
end
end

context "when retry is nil in the job payload (e.g. raw payload pushed by AWS Lambda)" do
it "treats the job as retryable by default and does not report on first failure" do
context = {
job: {
"class" => "SadWorker",
"jid" => "abc123",
"queue" => "default",
"retry_count" => nil
}
}

handler = Sentry::Sidekiq::ErrorHandler.new
handler.call(RuntimeError.new("I'm sad!"), context)

expect(transport.events.count).to eq(0)
end
end

context "when retry is not specified on the worker" do
before do
# this is required for Sidekiq to assign default options to the worker
Expand Down
Loading