[Backgroundrb-devel] Recalling threads

hemant kumar gethemant at gmail.com
Thu Mar 6 02:37:36 EST 2008

On Wed, 2008-03-05 at 18:34 +0000, Todd Tyree wrote:
> Hi,
> I want to use backgroundrb to set up dead-man timers on user accounts.
> If someone is inactive for a set period, then the system will
> automatically log them out and send an offline presence notification.
> I've got this working by spawning new workers with job keys and using
> page changes and periodic calls to refresh a countdown timer in the
> worker.  However, this becomes hard going if more than a few dozen
> users log in at the same time.  I've dug through the documentation and
> tried a few things to no avail.  What I'm wondering is, is it possible
> to add and access threads on a single worker using a job key?
> Alternately, is there a way to pre-fork a group of workers and then
> assign (and reassign) them job keys?
> us

If you lots of users coming in and spawning a worker for each them is
bad idea. You should probably be off using inbuilt thread pool.

However, it seems you want unique handle for each user. The best way to
achieve this is to use register_status with user_id or something inside
worker, so as when you invoke ask_status from your controller, you can
grab status based on user ids. What I am trying to say is, perhaps you
don't need a job_key for each thread invoked.

More information about the Backgroundrb-devel mailing list