Sha256: bd92c0d12ba7dec600265a35a32dea6945c8d13680a92f847ad7348b8654f4f2

Contents?: true

Size: 451 Bytes

Versions: 2

Compression:

Stored size: 451 Bytes

Contents

require 'sidekiq/api'

# This initializer inspects the currently scheduled Sidekiq workers,
# of which the Sidekiq::Snitch must always be one in a properly
# configured application.
#
# When none are found, schedule one to run immediately. The worker
# will then take care of rescheduling itself.
set = Sidekiq::ScheduledSet.new
length = set.select {|job| job.klass == "Sidekiq::Snitch" }.length

unless length > 0
  Sidekiq::Snitch.perform_async
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq_snitch-1.0.0 config/initializers/perform.rb
sidekiq_snitch-0.0.2 config/initializers/perform.rb