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 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
- work(Sponges::Configuration.worker, Sponges::Configuration.worker_method,
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
@@ -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
@@ -80,7 +80,7 @@ module Sponges
80
80
  @pids.srem pid
81
81
  Sponges.logger.info "Child #{pid} receive a #{signal} signal."
82
82
  rescue Errno::ESRCH => e
83
- Sponges.logger.error e
83
+ # Don't panic
84
84
  end
85
85
  end
86
86
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Sponges
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sponges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: