Class: CrawlStation::Launcher
- Inherits:
-
Object
- Object
- CrawlStation::Launcher
- Includes:
- Celluloid, Celluloid::Notifications
- Defined in:
- lib/crawl_station/launcher.rb
Instance Method Summary collapse
- #exit_message(_topic, data) ⇒ Object
-
#initialize ⇒ Launcher
constructor
A new instance of Launcher.
- #start ⇒ Object
Constructor Details
#initialize ⇒ Launcher
Returns a new instance of Launcher.
6 7 8 9 |
# File 'lib/crawl_station/launcher.rb', line 6 def initialize @exit_sign = false subscribe 'exit_launcher', :exit_message end |
Instance Method Details
#exit_message(_topic, data) ⇒ Object
24 25 26 |
# File 'lib/crawl_station/launcher.rb', line 24 def (_topic, data) @exit_sign = data end |
#start ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/crawl_station/launcher.rb', line 11 def start CS.logger.debug('station starting ... ') CS.concurrent_count.times do supervisor = CS::Producer.pool args: [CS.schedule, CS.cache] supervisor.async.start end loop do sleep(10) break if @exit_sign end end |