I am creating an auction system in Rails 3 (using PostgreSQL as a database).
Imagine you have a Product. The product has many offers.
Iβm worried about what happens when two different users click βBidβ at the same time (assuming I have at least 2 application servers and they get to the servers at the same time). I have two possible acceptable behaviors for this:
- one of them wins and the other receives an error message
- one of them βwinsβ, and the other bid is created next (each bet adds 0.01 euros to the price). Thus, all simultaneous bets are repeated until they are created
So my question is: how to deal with this problem on Rails 3? I think using regular transactions is not enough or is it?
source share