lib/backburner/workers/forking.rb in backburner-1.1.0 vs lib/backburner/workers/forking.rb in backburner-1.2.0.pre
- old
+ new
@@ -27,14 +27,18 @@
# Need to re-establish the connection to the server(s) after forking
# Waits for a job, works the job, and exits
def fork_one_job
pid = Process.fork do
- @connection = Connection.new(Backburner.configuration.beanstalk_url)
work_one_job
coolest_exit
end
Process.wait(pid)
+ end
+
+ def on_reconnect(conn)
+ @connection = conn
+ prepare
end
# Exit with Kernel.exit! to avoid at_exit callbacks that should belongs to
# parent process
# We will use exitcode 99 that means the fork reached the garbage number