Topic: Do I need to cleanup database sessions?

I am using database sessions extensively ala the Agile Web Dev model and storing them in the db. Do they stay there forever? Does rails clean them up for me or do I need to do this myself and if so, whats the best way?

Re: Do I need to cleanup database sessions?

You'll need to do this yourself. 

When we stored our sessions in the db we ran a weekly job that cleared them out.

I found a random link that might help you out.

https://wincent.com/wiki/Clearing_out_o … L_database

Play postseason fantasy sports at Fantasy Postseason - Written in RoR

Re: Do I need to cleanup database sessions?

Would it be easy to run a weekly or daily rails cron job to do rake db:sessions:clear?

Re: Do I need to cleanup database sessions?

If you do rake db:sessions:clear it will wipe every session..  if that is what you want fine but it is probably best to just wipe the older ones as shown in that link that I provided.

Play postseason fantasy sports at Fantasy Postseason - Written in RoR

Re: Do I need to cleanup database sessions?

The link advises I do it as a sql query but it seems more elegant to do it as a rake task. If I clear the sessions database every midnight it would be fine as nobody is logged in at that time. Only robots lurk at midnight. Even if somebody was working on the system they would only be kicked out momentarily.

I could do this manually once a week I guess, using rake.