deadly_serious 2.0.0.pre.rc1 → 2.0.0.pre.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78ea6f0fb905d3b08feef450651add4e28b7ed69
4
- data.tar.gz: 3bfb8bba7ca19b826ed1cfdefbb81cde2453eb33
3
+ metadata.gz: 674822fd44059d7b252f5083dcbc982f633472b4
4
+ data.tar.gz: 56612d70f7df34ec08bd9a6ecd795e8d58a17b60
5
5
  SHA512:
6
- metadata.gz: 83cccbcf342d6e331f8bb050157446fef59a680e5968a8d00a1b21323d976d20f301a5844e899f1031d4cc1d0e049a04b47f7c11eef5214a58f1f552e8f05c6b
7
- data.tar.gz: 3afb1d45bfc69a4721fb981949bb63e1b02f7a3765a417b8fe9eb2ad5adb9d60a4d81f51e3194d45a61466ebfd02e8040b5666e21768c4e10aca365b527901f2
6
+ metadata.gz: ca3933abc30d5f415bc5ac14fd01d93fbfdff61dd1f0e082bb9d1cae4d56f7ab83b3f25380c16ec6623de835079f95a805634a386b533cc598126c18d450a9c7
7
+ data.tar.gz: e46b9f206e57290d25dc5f9bdb8b8437bdcf085ed51d9be3722b34cd3593d54d09565ec42546238f25f5ab175d9a2131fbb0cb6d6d0439b85c5b50c98b13f02d
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.2
1
+ ruby-2.1
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'bundler', '~> 1.0'
22
22
  spec.add_development_dependency 'rake', '~> 10.0'
23
23
  spec.add_development_dependency 'pry', '~> 0.10'
24
- spec.add_development_dependency 'guard-rspec', '~> 4.0'
24
+ spec.add_development_dependency 'guard-rspec', '~> 4.6', '>= 4.6.4'
25
25
 
26
26
  spec.add_dependency 'oj', '~> 2.0'
27
27
  spec.add_dependency 'multi_json', '~> 1.0'
@@ -10,7 +10,9 @@ module DeadlySerious
10
10
  preserve_pipe_dir: false,
11
11
  &block)
12
12
 
13
- @config = Config.new(data_dir: data_dir, pipe_dir: pipe_dir, preserve_pipe_dir: preserve_pipe_dir)
13
+ @config = DeadlySerious::Engine::Config.new(data_dir: data_dir,
14
+ pipe_dir: pipe_dir,
15
+ preserve_pipe_dir: preserve_pipe_dir)
14
16
  @block = block
15
17
  @pids = []
16
18
  end
@@ -19,9 +21,9 @@ module DeadlySerious
19
21
  @config.setup
20
22
  @block.call(self)
21
23
  wait_children
22
- rescue => e
23
- kill_children
24
- raise e
24
+ rescue
25
+ clean_suicide
26
+ raise
25
27
  ensure
26
28
  @config.teardown if @config
27
29
  end
@@ -78,21 +80,22 @@ module DeadlySerious
78
80
  end
79
81
  end
80
82
 
83
+ def clean_suicide
84
+ @pids ||= [] # Avoid stupid errors
85
+ @pids.each { |pid| Process.kill('SIGTERM', pid) rescue nil }
86
+ Timeout::timeout(5) { wait_children }
87
+ rescue Timeout::Error
88
+ @pids.each { |pid| Process.kill('SIGKILL', pid) rescue nil }
89
+ ensure
90
+ @pids.clear
91
+ end
92
+
81
93
  private
82
94
 
83
95
  def wait_children
84
96
  Process.waitall
85
97
  end
86
98
 
87
- def kill_children
88
- gpid = Process.gid
89
- Process.kill('SIGTERM', -gpid) rescue nil
90
- Timeout::timeout(5) { wait_children }
91
- @pids.clear
92
- rescue Timeout::Error
93
- Process.kill('SIGKILL', -gpid) rescue nil
94
- end
95
-
96
99
  def set_process_name(name)
97
100
  $0 = name
98
101
  end
@@ -1,3 +1,3 @@
1
1
  module DeadlySerious
2
- VERSION = '2.0.0-rc1'
2
+ VERSION = '2.0.0-rc2'
3
3
  end
@@ -3,9 +3,10 @@ include DeadlySerious::Engine
3
3
 
4
4
  describe SocketChannel do
5
5
  let(:test_config) do
6
- Config.new(data_dir: "/tmp/test_deadly_serious#{Process.pid}",
7
- pipe_dir: "/tmp/test_deadly_serious#{Process.pid}",
8
- preserve_pipe_dir: false)
6
+ # Conflicts with RbConfig in < 2.1
7
+ DeadlySerious::Engine::Config.new(data_dir: "/tmp/test_deadly_serious#{Process.pid}",
8
+ pipe_dir: "/tmp/test_deadly_serious#{Process.pid}",
9
+ preserve_pipe_dir: false)
9
10
  end
10
11
 
11
12
  matcher :produce_a do |expected|
@@ -72,6 +72,15 @@ describe Pipeline do
72
72
  expect(finish - start).to be >= DELAY
73
73
  end
74
74
 
75
+ it 'kills children' do
76
+ pipeline = Pipeline.new do |p|
77
+ p.spawn_process(TestComponentTime, DELAY)
78
+ p.clean_suicide
79
+ p.spawn_process(TestComponentTime, DELAY)
80
+ end
81
+ expect { pipeline.run }.not_to raise_error
82
+ end
83
+
75
84
  it 'spawns children in parallel' do
76
85
  pipeline = Pipeline.new do |p|
77
86
  p.spawn_process(TestComponentTime, DELAY)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deadly_serious
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.rc1
4
+ version: 2.0.0.pre.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronie Uliana
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-04 00:00:00.000000000 Z
11
+ date: 2015-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,20 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '4.0'
61
+ version: '4.6'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 4.6.4
62
65
  type: :development
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
66
69
  - - "~>"
67
70
  - !ruby/object:Gem::Version
68
- version: '4.0'
71
+ version: '4.6'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 4.6.4
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: oj
71
77
  requirement: !ruby/object:Gem::Requirement