File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,19 @@ def run
2727 end
2828 end
2929
30+ class Poison
31+ CONSUMERS = { }
32+
33+ def initialize ( consumer )
34+ @consumer_id = consumer . object_id
35+ CONSUMERS [ @consumer_id ] = consumer
36+ end
37+
38+ def run
39+ CONSUMERS [ @consumer_id ] . shutdown
40+ end
41+ end
42+
3043 before do
3144 Actionable . ran . clear
3245 end
@@ -63,8 +76,7 @@ def run
6376 # consumed
6477 sleep 2
6578 assert_equal 1 , q . length
66- t . kill
67- q . pop
79+ q << Poison . new ( c )
6880 end
6981
7082 it "resumes" do
@@ -86,7 +98,7 @@ def run
8698 consumed . await
8799
88100 assert_equal 0 , q . length , 'all jobs should be consumed'
89- t . kill
101+ q << Poison . new ( c ) # gracefully shutdown the consumer
90102 end
91103
92104 it "shuts down" do
@@ -105,7 +117,7 @@ def run
105117 assert_equal 1 , q . length
106118 assert c . shutdown?
107119 q . pop until q . empty?
108- t . kill
120+ q << Poison . new ( c )
109121 end
110122 end
111123end
You can’t perform that action at this time.
0 commit comments