async-container 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/async/container/threaded.rb +2 -1
- data/lib/async/container/version.rb +1 -1
- data/spec/async/container/forked_spec.rb +0 -13
- data/spec/async/container/hybrid_spec.rb +0 -13
- data/spec/async/container/shared_examples.rb +13 -0
- data/spec/async/container/threaded_spec.rb +0 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f4a826134a9cc5edf2efbf407a51cac5666ac8f9f1b1102f3ca20b06b512c31
|
4
|
+
data.tar.gz: e85ed96741f3998672148983ded42741ad9d0da62855d0f2a1193a5466ee2f9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6d866442204b871f06aca9cb8311d7e0faa12175edfa23c95ea1cd48174ebe185417aa7429c1b6e003022c58a4a7498097ab951dfaf8f02dbf391255032257c
|
7
|
+
data.tar.gz: ebeeeb552e814edd808e760ef40299e8702821999f6bf713a1ddac3bc5247b009965a7facc16d340ebf64aee0a6cda4c29c3f84a3efae8fde66c99024cc6d537
|
@@ -62,7 +62,6 @@ module Async
|
|
62
62
|
thread = ::Thread.new do
|
63
63
|
thread = ::Thread.current
|
64
64
|
|
65
|
-
thread.report_on_exception = false
|
66
65
|
thread.name = name if name
|
67
66
|
|
68
67
|
instance = Instance.new(thread)
|
@@ -82,6 +81,8 @@ module Async
|
|
82
81
|
break
|
83
82
|
end
|
84
83
|
end
|
84
|
+
# rescue Interrupt
|
85
|
+
# # Graceful exit.
|
85
86
|
end
|
86
87
|
|
87
88
|
@threads << thread
|
@@ -25,19 +25,6 @@ require_relative 'shared_examples'
|
|
25
25
|
RSpec.describe Async::Container::Forked do
|
26
26
|
it_behaves_like Async::Container
|
27
27
|
|
28
|
-
it "can run concurrently" do
|
29
|
-
subject.async(name: "Sleepy Jerry") do |task, instance|
|
30
|
-
3.times do |i|
|
31
|
-
puts "Counting Sheep #{i}"
|
32
|
-
instance.name = "Counting Sheep #{i}"
|
33
|
-
|
34
|
-
# sleep 2
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
subject.wait
|
39
|
-
end
|
40
|
-
|
41
28
|
it "can restart child" do
|
42
29
|
trigger = IO.pipe
|
43
30
|
pids = IO.pipe
|
@@ -25,19 +25,6 @@ require_relative 'shared_examples'
|
|
25
25
|
RSpec.describe Async::Container::Hybrid do
|
26
26
|
it_behaves_like Async::Container
|
27
27
|
|
28
|
-
it "can run concurrently" do
|
29
|
-
subject.run(count: 1, name: "Sleepy Jerry") do |task, instance|
|
30
|
-
3.times do |i|
|
31
|
-
puts "Counting Sheep #{i}"
|
32
|
-
instance.name = "Counting Sheep #{i}"
|
33
|
-
|
34
|
-
# sleep 2
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
subject.wait
|
39
|
-
end
|
40
|
-
|
41
28
|
it "should be multiprocess" do
|
42
29
|
expect(described_class).to be_multiprocess
|
43
30
|
end
|
@@ -33,4 +33,17 @@ RSpec.shared_examples_for Async::Container do
|
|
33
33
|
output.close
|
34
34
|
expect(input.read).to be == "Hello World"
|
35
35
|
end
|
36
|
+
|
37
|
+
it "can run concurrently" do
|
38
|
+
subject.async(name: "Sleepy Jerry") do |task, instance|
|
39
|
+
3.times do |i|
|
40
|
+
puts "Counting Sheep #{i}"
|
41
|
+
instance.name = "Counting Sheep #{i}"
|
42
|
+
|
43
|
+
sleep 0.01
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
subject.wait
|
48
|
+
end
|
36
49
|
end
|
@@ -25,14 +25,6 @@ require_relative 'shared_examples'
|
|
25
25
|
RSpec.describe Async::Container::Threaded do
|
26
26
|
it_behaves_like Async::Container
|
27
27
|
|
28
|
-
it "can run concurrently" do
|
29
|
-
subject.async(name: "Sleepy Jerry") do
|
30
|
-
sleep 1
|
31
|
-
end
|
32
|
-
|
33
|
-
subject.stop
|
34
|
-
end
|
35
|
-
|
36
28
|
it "should not be multiprocess" do
|
37
29
|
expect(described_class).to_not be_multiprocess
|
38
30
|
end
|