Class: RuboCop::Cop::SidekiqEnt::LimiterWithoutWaitTimeout
- Defined in:
- lib/rubocop/cop/sidekiq_ent/limiter_without_wait_timeout.rb
Overview
Checks that rate limiters specify wait_timeout option.
Without wait_timeout, jobs will wait indefinitely for a limit slot, potentially blocking Sidekiq worker threads. Setting wait_timeout: 0 for class constant limiters makes the job fail fast and rely on retry.
Constant Summary collapse
- MSG =
'Specify `wait_timeout` option for rate limiters to avoid blocking worker threads.'
Instance Method Summary collapse
- #on_send(node) ⇒ Object (also: #on_csend)
Methods inherited from Base
#limiter_creation?, #unique_for_option?, #unique_until_option?
Methods included from Sidekiq::Language
#active_job_class?, #perform_call?, #sidekiq_include?, #sidekiq_options_call?
Instance Method Details
#on_send(node) ⇒ Object Also known as: on_csend
25 26 27 28 29 30 31 |
# File 'lib/rubocop/cop/sidekiq_ent/limiter_without_wait_timeout.rb', line 25 def on_send(node) limiter_creation?(node) do |_method, _name, _limit| return if wait_timeout_option?(node) add_offense(node) end end |