File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ def work(interval = 5.0, &block)
140
140
Process . wait ( @child )
141
141
else
142
142
procline "Processing #{ job . queue } since #{ Time . now . to_i } "
143
+ redis . client . reconnect # Don't share connection with parent
143
144
perform ( job , &block )
144
145
exit! unless @cant_fork
145
146
end
Original file line number Diff line number Diff line change @@ -431,4 +431,10 @@ def self.perform
431
431
assert_equal queue2 , Resque ::Failure . all ( 0 ) [ 'queue' ]
432
432
assert_equal 1 , Resque ::Failure . count
433
433
end
434
+
435
+ it "reconnects to redis after fork" do
436
+ original_connection = Resque . redis . client . connection . instance_variable_get ( "@sock" )
437
+ @worker . work ( 0 )
438
+ assert_not_equal original_connection , Resque . redis . client . connection . instance_variable_get ( "@sock" )
439
+ end
434
440
end
You can’t perform that action at this time.
0 commit comments