On Aug 4, 5:04 pm, Hassan Schroeder <[email protected]>
wrote:
> On Mon, Aug 3, 2009 at 8:43 PM, s.ross<[email protected]> wrote:
> > Out of curiosity, is there a reason the cookie-based sessions would
> > not work for you? These auto-clean and don't clutter up your database.
> > For your security timeout, I'd suggest something like this:
>
> Not being the OP, this is a bit of a hijack, but... :-)
>
> >   around_filter :check_auto_logout      # This needs to be run first
> > to make sure we don't have stale expired sessions
>
> This seems like it would fit the OP's use case, but not mine, in that
> it depends on another request coming in after the session timeout
> period has expired.
>
> Would you have a suggestion on cleanup of abandoned sessions?
>
> Here's my use case:
>
> Web site sells unique/limited quantity items.
> User puts item in cart; item is now unavailable to other users.
> User abandons cart (stops interacting with site for 30 minutes)
> Cart is "emptied", item is returned to inventory.

Well presumably in your case you have to track the fact that this item
is now locked or whatever in the database. Make it so that such locks
are updated while the user keeps using the site and have a cronjob
that expires locks from users that have not been active since X.
Another possibility is to have a locked_until field, in which case you
don't need to clear out the lock at all.

Fred
>
> Interested in any ideas on the most Rails-ish way to handle this.
>
> --
> Hassan Schroeder ------------------------ [email protected]
> twitter: @hassan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to