Skip to content

Commit

Permalink
Worker is dead term (#229)
Browse files Browse the repository at this point in the history
* ✏️ Fix spelling

* 🐛 Queue always nil in default_retries_exhausted_message

- worker is no longer used in most scenarios
  - See: https://github.com/sidekiq/sidekiq/wiki/Best-Practices#4-use-precise-terminology
- keys are string, symbol lookups fail
- Add test
  • Loading branch information
pboling authored Nov 26, 2024
1 parent c31b54f commit d44a4e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ def within_sidekiq_retries_exhausted_block(user_msg = {}, exception = default_re

def default_retries_exhausted_message
{
'queue' => get_sidekiq_options[:worker],
'queue' => get_sidekiq_options['queue'],
'class' => name,
'args' => [],
'error_message' => 'An error occured'
'error_message' => 'An error occurred'
}
end

def default_retries_exhausted_exception
StandardError.new('An error occured')
StandardError.new('An error occurred')
end
end
end
Expand Down
9 changes: 9 additions & 0 deletions spec/rspec/sidekiq/helpers/retries_exhausted_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ def self.baz(exception)
end
end

it 'has an exhausted message' do
expect(FooClass.default_retries_exhausted_message).to eq({
"args" => [],
"class" => "FooClass",
"error_message" => "An error occurred",
"queue" => "data",
})
end

it 'executes whatever is within the block' do
FooClass.within_sidekiq_retries_exhausted_block { expect(FooClass).to receive(:bar).with('hello') }
end
Expand Down

0 comments on commit d44a4e2

Please sign in to comment.