[Backgroundrb-devel] Deploying with capistrano issue. Resolution!

P. Mark Anderson mark at martianrover.com
Tue Feb 6 14:22:47 EST 2007


Somewhat related to the deployment issue, I like to make sure 
Backgroundrb is ready before launching workers and that's what this code 
does.  It lives in my ApplicationController.

pmark


#
# Confirm Backgroundrb is running and start if dead.
#
def prepare_backgroundrb
   begin
     # try to contact Backgroundrb in some way
     MiddleMan.gc!((Time.now-10.years).to_time)

   rescue
     begin
       `cd #{RAILS_ROOT} && script/backgroundrb start`
       sleep(10)
     rescue
       log.error("unable to start Backgroundrb: #{$!}")
     end
   end
end


More information about the Backgroundrb-devel mailing list