sponges 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sponges/cli.rb +6 -2
- data/lib/sponges/runner.rb +5 -6
- data/lib/sponges/supervisor.rb +1 -1
- data/lib/sponges/version.rb +1 -1
- metadata +1 -1
data/lib/sponges/cli.rb
CHANGED
@@ -7,9 +7,13 @@ module Sponges
|
|
7
7
|
option :size, type: :numeric
|
8
8
|
desc "Start workers"
|
9
9
|
def start(options = {})
|
10
|
-
Sponges::Runner.new(Sponges::Configuration.worker_name, options)
|
11
|
-
|
10
|
+
worker = Sponges::Runner.new(Sponges::Configuration.worker_name, options)
|
11
|
+
if Sponges::Configuration.worker_args
|
12
|
+
worker.work(Sponges::Configuration.worker, Sponges::Configuration.worker_method,
|
12
13
|
Sponges::Configuration.worker_args)
|
14
|
+
else
|
15
|
+
worker.work(Sponges::Configuration.worker, Sponges::Configuration.worker_method)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
option :gracefully, type: :boolean
|
data/lib/sponges/runner.rb
CHANGED
@@ -12,16 +12,15 @@ module Sponges
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def work(worker, method, *args, &block)
|
15
|
-
Sponges.logger.info "Runner #{@name} start message received."
|
16
|
-
@supervisor = fork_supervisor(worker, method, *args, &block)
|
17
|
-
trap_signals
|
18
|
-
Sponges.logger.info "Supervisor started with #{@supervisor} pid."
|
19
15
|
if daemonize?
|
20
16
|
Sponges.logger.info "Supervisor daemonized."
|
21
17
|
Process.daemon
|
22
|
-
else
|
23
|
-
Process.waitpid(@supervisor) unless daemonize?
|
24
18
|
end
|
19
|
+
Sponges.logger.info "Runner #{@name} start message received."
|
20
|
+
@supervisor = fork_supervisor(worker, method, *args, &block)
|
21
|
+
trap_signals
|
22
|
+
Sponges.logger.info "Supervisor started with #{@supervisor} pid."
|
23
|
+
Process.waitpid(@supervisor) unless daemonize?
|
25
24
|
end
|
26
25
|
|
27
26
|
private
|
data/lib/sponges/supervisor.rb
CHANGED
data/lib/sponges/version.rb
CHANGED