Sha256: 111d9afc4328439ac93c3826468f193eeb27f7cb6dfe1748255f24dc18f2b4da
Contents?: true
Size: 1.02 KB
Versions: 11
Compression:
Stored size: 1.02 KB
Contents
#require Sidekiq original launcher require 'sidekiq/launcher' #require cron poller require 'sidekiq/cron/poller' # For Cron we need to add some methods to Launcher # so look at the code bellow. # # we are creating new cron poller instance and # adding start and stop commands to launcher module Sidekiq class Launcher #Add cron poller to launcher attr_reader :cron_poller #remember old initialize alias_method :old_initialize, :initialize #add cron poller and execute normal initialize of Sidekiq launcher def initialize(options) @cron_poller = Sidekiq::Cron::Poller.new old_initialize options end #remember old run alias_method :old_run, :run #execute normal run of launcher and run cron poller def run old_run cron_poller.async.poll(true) end #remember old stop alias_method :old_stop, :stop #execute normal stop of launcher and stop cron poller def stop cron_poller.async.terminate if poller.alive? old_stop end end end
Version data entries
11 entries across 11 versions & 1 rubygems