On Apr 14, 10:55 pm, steveluscher <goo...@steveluscher.com> wrote:
> What do you think is the best way to prevent overselling in this case?
> I've considered:
>
> * Table locking (sucks)
> * Setting a lock file per-Product (filesystem-y and not elegantly
> scalable past one machine)
> * Setting a lock variable per-Product in a memcached store
> * A single-worker queue that validates and processes orders in
> sequence
> * A per Product single-worker queue that validates and processes
> orders in sequence
> * Something I haven't considered?
>

It sort of depends where the information that only 3 more orders for
Product X lives.
For example if the products table has a stock_remaining column, then
for me the natural thing to do would be to use optimistic locking on
the products table
I wrote up some possibilities at 
http://www.spacevatican.org/2008/6/8/dealing-with-concurrency

Fred
> What do you think?
> Steve!
--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to