[Backgroundrb-devel] [Rails] [ANN] BackgrounDRb New release.

hemant gethemant at gmail.com
Tue Jul 4 00:42:02 EDT 2006


Thanks Erza,

Just updated the SVN....
Yeah...i had the idea that, i must either reset the rails session after half
an hour, or check for availability of the Middleman class object!!

Anyway..thanks for the immortal worker threads, they are a required feature
i guess.


On 7/4/06, Ezra Zygmuntowicz <ezmobius at gmail.com> wrote:
>
>
> On Jul 3, 2006, at 5:36 PM, hemant wrote:
>
> > Yeah looks fine.
> >
> > BTW, you didn't tell me abt, what happens to the session object,
> > when after 30 minutes that thread gets deleted?
> >
> >
>
> Hemant-
>
>         Ok after thinking about things this is what it in the current svn.
> I
> think you are right to wonder about what to do with a stale session.
> So I changed things to behave like this:
>
> When you do:
> session[:job_key] = MiddleMan.new_worker(:class => :long_worker,
>
>            :args => 'whatever')
>
>
> It will create an immortal worker by default if you don't include
> the :ttl param. But you can include the :ttl if you want to be specific.
>
> #So this will create an immortal worker too:
> session[:job_key] = MiddleMan.new_worker(:class => :long_worker,
>
>           :args => 'whatever',
>
>           :ttl => :immortal)
>
> So now you have to specify the :ttl param if you want your worker to
> be killed after a certain amount of time.
>
> session[:job_key] = MiddleMan.new_worker(:class => :long_worker,
>
>           :args => 'whatever',
>
>           :ttl => 900) # 15 minutes
>
> When you create immortal workers you are responsible for deleting
> them when you are done. When you do use caching you still get a
> default :ttl of 10 minutes. And you should use the block form of
> cache_get so that if the cache has expired, it will get filled again
> and behave like a cache hit.
>
> So to answer your question about what to do with the session if your
> worker dies is something like this:
>
> unless MiddleMan[session[:jobkey]].nil?
>     MiddleMan[session[:jobkey]].some_method
> end
>
> So I recommend either using immortal workers and deleting them with
> delete_worker or being careful about checking that your job is alive
> before calling methods on it.
>
>
> Cheers-
> -Ezra
>
>


-- 
nothing much to talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060704/299fbfbc/attachment-0001.html 


More information about the Backgroundrb-devel mailing list