[Backgroundrb-devel] Req: Workers as singletons

Ezra Zygmuntowicz ezmobius at gmail.com
Mon Jul 3 18:28:24 EDT 2006

On Jul 3, 2006, at 2:45 PM, Günter Ladwig wrote:

> On 03.07.2006, at 22:19, Ezra Zygmuntowicz wrote:
>> Hi Gunter-
>>  	I can add a singleton type worker probably. Can you tell me what
>> your use case is for needing this? I'm curious as to how you would
>> use or what you plan on doing with singleton workers. Are you
>> defining your worker classes as actual singletons using include
>> Singleton? If so then maybe I can make a different type of
>> superclass to inherit your workers from that is a true singleton.
>> I'll have to think about it a bit. I just added new job management
>> stuff to the threading model so I will have to work that in with
>> your singleton idea but I'm sure I can come up with a nice way of
>> doing this for you.
> No, the worker class is not defined as a Singleton. It's just that I
> need only one instance of the worker. I'm not using the worker for
> temporary background calculations (which seems to be the common use
> case), but instead as a background process that periodically updates
> the database and takes requests from the Rails app. It should not be
> killed and respawned because it has persistent connections to other
> servers.
> Günter


	OK I see what you want to do. I will come up with a way to do that  
for you. I also just changed things so that if you don't specify  
a :ttl param when you do new_worker then your worker will  
become :immortal. The only way to delete an immortal worker is by  
calling gc! or using delete_worker directly.


More information about the Backgroundrb-devel mailing list