Hi Roderick,

Could you provide an example of how this would work?

regards,
C.

On May 23, 11:58 am, Roderick van Domburg <rails-mailing-l...@andreas-
s.net> wrote:
> Marnen Laibow-Koser wrote:
> > Cathal O'Riordan wrote:
> > [...]
> >> My concern is that my code won't guard against a race condition where
> >> 2 or more users try to register for a course that is near it capacity
> >> limit. My first thought was to wrap the registration code in a
> >> transaction and rollback if the capacity of registrations on a course
> >> has been exceeded.
> > [...]
>
> > Use check constraints in the DB and let *it*, not your app, worry about
> > concurrency issues!
>
> That's one approach. Wrapping it up in a transaction with read isolation
> would work fine too. Alternatively (and better for concurrency), keep a
> counter cache on the registration_count and use the default isolation
> level.
>
> --
> Roderick van Domburg
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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