Class: RuboCop::Cop::SidekiqEnt::LimiterWithoutLockTimeout
- Defined in:
- lib/rubocop/cop/sidekiq_ent/limiter_without_lock_timeout.rb
Overview
Checks that concurrent limiters specify lock_timeout option.
Without lock_timeout, the default (30 seconds) may not cover jobs with longer execution times, causing locks to expire prematurely.
Constant Summary collapse
- MSG =
'Specify `lock_timeout` option for concurrent limiters to match job execution time.'
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
21 22 23 24 25 26 27 28 |
# File 'lib/rubocop/cop/sidekiq_ent/limiter_without_lock_timeout.rb', line 21 def on_send(node) limiter_creation?(node) do |method, _name, _limit| return unless method == :concurrent return if lock_timeout_option?(node) add_offense(node) end end |