[Backgroundrb-devel] Clearing ActiveRecord Sessions
Michael D'Auria
michael.dauria at gmail.com
Sun Sep 24 21:20:20 EDT 2006
Hello all,
I am interested in using BackgrounDRb to clear out ActiveRecord based
sessions. I have this working, just with a small hitch, here is the code:
class ClearSessionsWorker < BackgrounDRb::Rails
repeat_every 7.minutes
first_run Time.now
def do_work(args)
Session.destroy_all(["updated_at < ?", 20.minute.ago ])
end
end
It's not very complicated and does remove sessions, it's just that once the
job is done, the thread hangs out leaving a connection to my database open.
After some time, MySQL complains about having too many open connections. I
was just curious what i am missing. I have tried using "kill", but that
only seems to run the job once and not every 7 minutes like i so nicely ask
:). I have also tried "terminate", but that did not seem to do anything for
me. Any help is greatly appreciated.
Thanks,
.: Michael :.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060924/189c4e5c/attachment.html
More information about the Backgroundrb-devel
mailing list