ringleader 1.1.4 → 1.1.5.pre0

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ module Ringleader
15
15
  die "must provide a filename" if argv.empty?
16
16
  die "could not find config file #{argv.first}" unless File.exist?(argv.first)
17
17
 
18
- if opts.verbose?
18
+ if opts.verbose
19
19
  Celluloid.logger.level = ::Logger::DEBUG
20
20
  end
21
21
 
@@ -23,7 +23,7 @@ module Ringleader
23
23
  @stopping = true
24
24
  info "shutting down..."
25
25
  @apps.values.map do |app|
26
- Thread.new { app.stop }
26
+ Thread.new { app.stop if app.alive? }
27
27
  end.map(&:join)
28
28
  end
29
29
  end
@@ -30,6 +30,7 @@ module Ringleader
30
30
  #
31
31
  # Returns true if the app started, false if not.
32
32
  def start
33
+ return false if @stopping
33
34
  if @running
34
35
  true
35
36
  elsif @starting
@@ -54,6 +55,7 @@ module Ringleader
54
55
  # zombies), use KILL instead.
55
56
  def stop
56
57
  return unless @pid
58
+ @stopping = true
57
59
 
58
60
  children = child_pids @pid
59
61
 
@@ -94,6 +96,7 @@ module Ringleader
94
96
  @pid = nil
95
97
  @wait_for_port.terminate if @wait_for_port.alive?
96
98
  @wait_for_exit.terminate if @wait_for_exit.alive?
99
+ @stopping = nil
97
100
  signal :running, false
98
101
  end
99
102
 
@@ -178,8 +181,9 @@ module Ringleader
178
181
  end
179
182
 
180
183
  # Internal: kill orphaned processes
181
- def reap_orphans(child_pids)
182
- child_pids.each do |pid|
184
+ def reap_orphans(pids)
185
+ pids.each do |pid|
186
+ debug "checking for child #{pid}"
183
187
  next unless Sys::ProcTable.ps(pid)
184
188
  error "child process #{pid} was orphaned, killing it"
185
189
  begin
@@ -192,6 +196,7 @@ module Ringleader
192
196
 
193
197
  # Internal: returns all child pids of the given parent
194
198
  def child_pids(parent_pid)
199
+ debug "retrieving child pids of #{parent_pid}"
195
200
  proc_table = Sys::ProcTable.ps
196
201
  children_of parent_pid, proc_table
197
202
  end
@@ -27,8 +27,11 @@ module Ringleader
27
27
 
28
28
  def proxy(from, to)
29
29
  ::IO.copy_stream from, to
30
- rescue IOError
30
+ rescue EOFError
31
31
  # from or to were closed
32
+ rescue IOError, SystemCallError => e
33
+ # something else went wrong, like a connection reset or timeout: log it
34
+ error e
32
35
  ensure
33
36
  from.close unless from.closed?
34
37
  to.close unless to.closed?
@@ -1,3 +1,3 @@
1
1
  module Ringleader
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5.pre0"
3
3
  end
data/ringleader.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency "trollop", "~> 1.16.2"
23
23
  gem.add_dependency "rainbow", "~> 1.1.4"
24
24
  gem.add_dependency "color", "~> 1.4.1"
25
- gem.add_dependency "sys-proctable", "~> 0.9.3"
25
+ gem.add_dependency "sys-proctable", "= 0.9.1"
26
26
 
27
27
  gem.add_development_dependency "rake"
28
28
  gem.add_development_dependency "rspec", "~> 2.11.0"
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ringleader
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
5
- prerelease:
4
+ version: 1.1.5.pre0
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nathan Witmer
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-17 00:00:00.000000000 Z
12
+ date: 2013-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: celluloid
@@ -112,17 +112,17 @@ dependencies:
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
115
- - - ~>
115
+ - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.9.3
117
+ version: 0.9.1
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  none: false
122
122
  requirements:
123
- - - ~>
123
+ - - '='
124
124
  - !ruby/object:Gem::Version
125
- version: 0.9.3
125
+ version: 0.9.1
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rake
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -256,12 +256,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
256
256
  required_rubygems_version: !ruby/object:Gem::Requirement
257
257
  none: false
258
258
  requirements:
259
- - - ! '>='
259
+ - - ! '>'
260
260
  - !ruby/object:Gem::Version
261
- version: '0'
262
- segments:
263
- - 0
264
- hash: 3327461616864805707
261
+ version: 1.3.1
265
262
  requirements: []
266
263
  rubyforge_project:
267
264
  rubygems_version: 1.8.23