Module: Sidekiq::Cron::Launcher

Defined in:
lib/sidekiq/cron/launcher.rb

Constant Summary collapse

DEFAULT_POLL_INTERVAL =
30

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cron_pollerObject (readonly)

Add cron poller to launcher.



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

def cron_poller
  @cron_poller
end

Instance Method Details

#initialize(options) ⇒ Object

Add cron poller and execute normal initialize of Sidekiq launcher.



17
18
19
20
21
22
# File 'lib/sidekiq/cron/launcher.rb', line 17

def initialize(options)
  options[:cron_poll_interval] = DEFAULT_POLL_INTERVAL if options[:cron_poll_interval].nil?

  @cron_poller = Sidekiq::Cron::Poller.new(options) if options[:cron_poll_interval] > 0
  super(options)
end

#quietObject

Execute normal quiet of launcher and quiet cron poller.



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

def quiet
  cron_poller.terminate if @cron_poller
  super
end

#runObject

Execute normal run of launcher and run cron poller.



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

def run
  super
  cron_poller.start if @cron_poller
end

#stopObject

Execute normal stop of launcher and stop cron poller.



37
38
39
40
# File 'lib/sidekiq/cron/launcher.rb', line 37

def stop
  cron_poller.terminate if @cron_poller
  super
end