Class: CrawlStation::Launcher

Inherits:
Object
  • Object
show all
Includes:
Celluloid, Celluloid::Notifications
Defined in:
lib/crawl_station/launcher.rb

Instance Method Summary collapse

Constructor Details

#initializeLauncher

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 exit_message(_topic, data)
  @exit_sign = data
end

#startObject



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