Class: Jiggler::Manager
Instance Method Summary
collapse
#log_error, #log_error_short, #logger, #safe_async, #scan_all, #tid
Constructor Details
#initialize(config, collection) ⇒ Manager
Returns a new instance of Manager.
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/jiggler/manager.rb', line 10
def initialize(config, collection)
@workers = Set.new
@done = false
@config = config
@timeout = @config[:timeout]
@collection = collection
init_acknowledger_and_fetcher
@config[:concurrency].times do
@workers << init_worker
end
end
|
Instance Method Details
#start ⇒ Object
24
25
26
27
28
|
# File 'lib/jiggler/manager.rb', line 24
def start
@acknowledger.start
@fetcher.start
@workers.each(&:run)
end
|
#suspend ⇒ Object
30
31
32
33
34
35
|
# File 'lib/jiggler/manager.rb', line 30
def suspend
return if @done
@done = true
@fetcher.suspend
end
|
#terminate ⇒ Object
37
38
39
40
41
42
|
# File 'lib/jiggler/manager.rb', line 37
def terminate
suspend
schedule_shutdown
wait_for_workers
wait_for_acknowledger
end
|