[Backgroundrb-devel] [Newbie] Questions on having one worker being called by multiple users.

steef nobody swertyui at gmail.com
Wed Apr 30 04:05:57 EDT 2008


Hello,

As a certified newbie, I have a few questions on how to properly handle a
situation where multiple users may want to perform the same worker task at
the same time, but with different arguments.

Initially I opted towards making many very specific workers to have a
situation where it was highly unlikely that any two users would be asking
the same exact worker to do something.  Now I'm trying to consolidate
everything into as few workers as possible to conserve memory (I think?).
What it's come down to at this point is that I have 2 workers whose methods
are scheduled in config/backgroundrb.yml.  And one worker whose methods are
not scheduled and are intended to be called through user initiated actions.

My question is then - how should I go about handling the case where user1
has asked the user_worker to do_something at the same time user2 has asked
user_worker to do_something or do_something_else.

What happens when backgroundrb receives a worker request on a worker that is
half way through a method from a previous request?

Is there a way to ask a worker something along the lines of "are you busy
with another user's request right now?".

I'm trying not to spawn unique workers as I'm not sure how best to get rid
of them.  Would it make sense to create a new worker for the specific task,
run the task, and kill the worker if the user may want to run the task
fairly frequently?

- Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20080430/9f46d1bd/attachment.html>


More information about the Backgroundrb-devel mailing list