Class: Sidekiq::Launcher

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/cron/launcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Launcher

add cron poller and execute normal initialize of Sidekiq launcher



21
22
23
24
# File 'lib/sidekiq/cron/launcher.rb', line 21

def initialize(options)
  @cron_poller = Sidekiq::Cron::Poller.new
  old_initialize options
end

Instance Attribute Details

#cron_pollerObject (readonly)

Add cron poller to launcher



15
16
17
# File 'lib/sidekiq/cron/launcher.rb', line 15

def cron_poller
  @cron_poller
end

Instance Method Details

#old_initializeObject

remember old initialize



18
# File 'lib/sidekiq/cron/launcher.rb', line 18

alias_method :old_initialize, :initialize

#old_quietObject

remember old quiet



36
# File 'lib/sidekiq/cron/launcher.rb', line 36

alias_method :old_quiet, :quiet

#old_runObject

remember old run



27
# File 'lib/sidekiq/cron/launcher.rb', line 27

alias_method :old_run, :run

#old_stopObject

remember old stop



45
# File 'lib/sidekiq/cron/launcher.rb', line 45

alias_method :old_stop, :stop

#quietObject

execute normal quiet of launcher and quiet cron poller



39
40
41
42
# File 'lib/sidekiq/cron/launcher.rb', line 39

def quiet
  cron_poller.terminate
  old_quiet
end

#runObject

execute normal run of launcher and run cron poller



30
31
32
33
# File 'lib/sidekiq/cron/launcher.rb', line 30

def run
  old_run
  cron_poller.start
end

#stopObject

execute normal stop of launcher and stop cron poller



48
49
50
51
# File 'lib/sidekiq/cron/launcher.rb', line 48

def stop
  cron_poller.terminate
  old_stop
end