[Backgroundrb-devel] Using my models

Dave Dupre gobigdave at gmail.com
Fri Dec 21 13:48:49 EST 2007


Maybe I spoke to soon.  Everything works every time, but after the first
time I run it, "Some read error" shows up in the command prompt.  This is
only when called like:

script/backrgoundrb

There is nothing in the logs that shows an error.  Again, the job works
every time.

Not a big deal since I will not be running it this way in production
anyway.  Just an FYI...

Dave

On Dec 21, 2007 1:36 PM, Dave Dupre <gobigdave at gmail.com> wrote:

> That was it!  Now that I think of it, I think I made the same mistake with
> the old version as well.
>
> Thanks!  Now I can add the rest of my jobs.
>
> Dave
>
>
> On Dec 21, 2007 12:48 PM, Jason LaPier <jason.lapier at gmail.com> wrote:
>
> > On Dec 21, 2007 9:14 AM, Dave Dupre <gobigdave at gmail.com> wrote:
> > > I'm working on upgrading my app to the latest version of backgroundrb.
> >
> > > Everything went find until I tried to execute my tasks.
> > >
> > > Here is my simple worker for testing:
> > >
> > > class MscWorker < BackgrounDRb::MetaWorker
> > >   set_worker_name :msc_worker
> > >   def create(args = nil)
> > >     # this method is called, when worker is loaded for the first time
> > >   end
> > >   # Send a message to everyone
> > >   def send_message_to_all(args = nil)
> > >     Message.send_to_everyone (args[:sender], args[:subject],
> > args[:body],
> > > false)
> > >   rescue
> > >     logger.error "MscWorker - #{err.class}: #{err}"
> > >   end
> > > end
> > >
> > > Called like so:
> > > MiddleMan.ask_work (:worker => :msc_worker, :worker_method =>
> > > :send_message_to_all, :data => { :sender => sender, :subject =>
> > subject,
> > > :body => body })
> > >
> > > I get lots of errors starting with this:
> > >
> > /Users/dave/projects/backgroundrb1.0_msc/vendor/plugins/backgroundrb/server/master_worker.rb:31:in
> > > `load': undefined class/module User (ArgumentError)
> >
> > I'm taking a wild guess here, but I think the problem may be in
> > sending a user object to your worker via MiddleMan. Instead of using
> > "sender", maybe try { :sender_id => sender.id } and in your worker
> > look up the sender ( i.e. sender = User.find(sender_id) ).
> >
> > - Jason L.
> >
> >
> >
> > --
> > My Rails and Linux Blog: http://offtheline.net
> > _______________________________________________
> > Backgroundrb-devel mailing list
> > Backgroundrb-devel at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/backgroundrb-devel
> >
>
>
>
> --
> Dave Dupre
> (m) 617-921-1684




-- 
Dave Dupre
(m) 617-921-1684
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20071221/7bf8f785/attachment.html 


More information about the Backgroundrb-devel mailing list