mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Fix unset fetch strategy crashing requeue, #680
This commit is contained in:
parent
d403f4143a
commit
301bba7189
2 changed files with 6 additions and 3 deletions
|
@ -13,9 +13,8 @@ module Sidekiq
|
|||
TIMEOUT = 1
|
||||
|
||||
def initialize(mgr, options)
|
||||
klass = Sidekiq.options[:fetch] || BasicFetch
|
||||
@mgr = mgr
|
||||
@strategy = klass.new(options)
|
||||
@strategy = Fetcher.strategy.new(options)
|
||||
end
|
||||
|
||||
# Fetching is straightforward: the Manager makes a fetch
|
||||
|
@ -57,6 +56,10 @@ module Sidekiq
|
|||
def self.done?
|
||||
@done
|
||||
end
|
||||
|
||||
def self.strategy
|
||||
Sidekiq.options[:fetch] || BasicFetch
|
||||
end
|
||||
end
|
||||
|
||||
class BasicFetch
|
||||
|
|
|
@ -118,7 +118,7 @@ module Sidekiq
|
|||
# contract says that jobs are run AT LEAST once. Process termination
|
||||
# is delayed until we're certain the jobs are back in Redis because
|
||||
# it is worse to lose a job than to run it twice.
|
||||
Sidekiq.options[:fetch].bulk_requeue(@in_progress.values)
|
||||
Sidekiq::Fetcher.strategy.bulk_requeue(@in_progress.values)
|
||||
|
||||
# Clearing workers in Redis
|
||||
# NOTE: we do this before terminating worker threads because the
|
||||
|
|
Loading…
Add table
Reference in a new issue