[Backgroundrb-devel] Reload ActiveRecord before calling worker?

Eric Lin elin44 at gmail.com
Thu Mar 19 15:53:51 EDT 2009


I recently ran into a problem where BackgroundDRb would get stuck on a  
request invoked like this:

class SomeModel < ActiveRecord::Base
   ..
   def start_work
     update_attribute(:state, 'working')

     MiddleMan.worker(:some_worker).async_do_work(:arg =>  
{ :some_model => self })
   end
   ...
end

What seems to be causing the problem is the call to update_attribute  
before worker is called.  But if I insert a "self.reload" between  
those two calls, it works.  Does this sound familiar to anyone?

Eric


More information about the Backgroundrb-devel mailing list