On Thu, 2008-04-03 at 22:24 -0700, Dylan Markow wrote: > On Thu, Apr 3, 2008 at 10:12 PM, Dylan Markow <[EMAIL PROTECTED]> wrote: > > > > On Thu, Apr 3, 2008 at 8:57 PM, Dylan Markow <[EMAIL PROTECTED]> wrote: > > > I have a worker as follows: > > > > > > class SampleWorker < BackgrounDRb::MetaWorker > > > set_worker_name :sample_worker > > > def create(args = nil) > > > # this method is called, when worker is loaded for the first time > > > end > > > > > > def my_method > > > # Deliver test e-mail message > > > Notifications.deliver_message(1, "DM") > > > end > > > end > > > > > > I have a rails controller that calls the following code: > > > > > > worker = MiddleMan.worker(:sample_worker) > > > worker.my_method > > > > > > The problem is that the first time I load up the page for this action, > > > the worker method "my_method" doesn't seem to ever get called. There > > > is zero output from any of the backgroundrb log files. If I then > > > reload the page, it works fine (and continues to work fine until > > > backgroundrb is restarted). > > > > > > This happens whether I'm in dev. or prod. mode. > > > > > > > To clarify, if I restart rails AND backgroundrb at the same time, > > everything works fine. it's only if backgroundrb needs to restart on > > its own for some reason. It looks like when the backgroundrb process > > is restarted, rails doesn't realize this as it still sees port 11006 > > open. So my first request to the page results in the rails plugin > > attempting to write data to the socket. I'm assuming this screws > > something up, as upon the second attempt at loading my page, "rescue > > Errno::EPIPE" at line 64 of backgroundrb.rb is called, thus > > re-establishing the connection. I'm assuming this problem may be more > > closely related to the packet gem? (Not sure if there is a trac repo > > for packet). > > > > > One last note: If you have 5 mongrels running of your rails app, then > the worker will fail to fire 5 times (once for each mongrel), though > not always in a row (typically my second request works, but then my > 3rd or 4th, etc., won't) > > As it stands now, I'm setting up my deployment files to always restart > backgroundrb BEFORE rails to make sure that once each mongrel fires > up, they each have a valid instance of backgroundrb to point to.
Hi Dylan, Sorry for late reply, but I think I nailed down issues you mentioned. But you need to get latest code, which is not yet in git repo: 1. First update your packet. Get packet code from here: http://code.google.com/p/packet/source/checkout Install using: rake gem; sudo gem install packet-0.1.6.gem 2. Get backgroundrb code with fixes from: http://backgroundrb.gnufied.org/manual/backgroundrb.tar.gz Now, you are set. Your problems were because of a bug in Ruby itself and hence I have reverted connection to old style of connecting on each request. There was a bug in packet itself for frequent connection/disconnection. See, if above fixes your problem. I will be publishing both softwares upstream in few days. _______________________________________________ Backgroundrb-devel mailing list [email protected] http://rubyforge.org/mailman/listinfo/backgroundrb-devel
