I just installed BackgrounDRb to take care of sending emails to a list
of users and when I try to call the worker, it causes the request to
"freeze" until Mongrel times out.
The 'send_to' parameter is an array of user type (strings) which the
worker will use to filter the list to send the email to. If I remove
this array things work fine. So does this mean I'm limited to
primitive types when I call a worker function?
I just installed BackgrounDRb to take care of sending emails to a list
of users and when I try to call the worker, it causes the request to
"freeze" until Mongrel times out.
The 'send_to' parameter is an array of user type (strings) which the
worker will use to filter the list to send the email to. If I remove
this array things work fine. So does this mean I'm limited to
primitive types when I call a worker function?
Yes, I have been to the main backgroundrb site and followed their
instructions for installation and installed the packet and chronic
gems. I've also read through their documentation to see if I could
figure out what the problem is -- haven't found anything yet. Until I
get this worked out I have installed Spawn and it seems to work on my
local environment fine. I'm worried how that'll work in production,
so I'd like to get this figured out if possible.
Well, no worker method will accept two arguments in your code snippet
you are trying exactly the same.
If you want two arguments, i am afraid, you will have to pass them as an array.
gems. I've also read through their documentation to see if I could
figure out what the problem is -- haven't found anything yet. Until I
get this worked out I have installed Spawn and it seems to work on my
local environment fine. I'm worried how that'll work in production,
so I'd like to get this figured out if possible.
Well, no worker method will accept two arguments in your code snippet
you are trying exactly the same.
If you want two arguments, i am afraid, you will have to pass them as an
array.
I'm sure this is resolved by now, one way or the other, but i found that
it's simpler to pass all your arguments inside a single hash, eg
Then pull out at the other end just like a normal hash:
def send_invite_emails_test(arg_hash)
logger.debug("Start message...")
event = Event.find(arg_hash[:event_id])
...etc
end
Also, if you send through an active record object (which i know you
aren't doing), then it will die silently with no logging output
anywhere. That's my experience anyway. Just mentioning for future
browsers of this thread.
WRT logging, this probably isn't the smartest answer but the only way i
could do it was to make a new logger inside the worker: eg from one of
mine
class LmailWorker < BackgrounDRb::MetaWorker
set_worker_name :lmail_worker