[Backgroundrb-devel] accessing session data in worker

Michael D'Auria michael.dauria at gmail.com
Tue Oct 17 10:42:05 EDT 2006

I was accessing the Session model directly from within a worker and it was

class ClearSessionsWorker < BackgrounDRb::Rails

  repeat_every 7.minutes
  first_run Time.now

  def do_work(args)
    Session.destroy_all(["updated_at < ?", 20.minute.ago ])

    ::BackgrounDRb::MiddleMan.instance.delete_worker @_job_key

I just wasn't cleaning the workers up properly, but it was cleaning out
sessions as it should...

On 10/17/06, Bill Walton <bill.walton at charter.net> wrote:
> Hi Ezra,
> Ezra Zygmuntowicz wrote:
> > The session is not available in the workers.
> Thanks for clearing that up for me!  So the data 'inside' the session
> record
> is not available, but the session record IS?  I'm using BackgroundRB to do
> session cleanup for abandoned sessions.  I'm thinking that I can pass the
> session id to the worker and then, inside the worker, retrieve and delete
> that record with something like
> session_record = Session.find(:first, :conditions => ["sessid = ?",
> passed_in_session_id])
> session_record.destroy
> Is that right?  Or do I need to do something special to access that
> record?
> Thanks,
> Bill
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20061017/d7e9d4a2/attachment.html 

More information about the Backgroundrb-devel mailing list