In one of my views i am using a custom manager , the custom manager finds a user , alters his "balance" (where balance is an integer value) , and then saves the user with the new balance.
The problem occurs when http requests coming really fast on that view. Lets say the "original" value of a users balance is 10 . Two requests are made , each one asking for the users balance to be credited plus 5 of the original one. The "perfect" solution would be the first requests to be processed ,saved and then the second to do the same. However what happens is that the first request will come , it will do its query and load the object , and the second request will also do the query before the first request was able to complete the process of saving the new balance, because of that the second request will have and "out of date" balance which it will then save . So in the end the user will have 10 (origina ballance) + 5 (second request) = 15 on his balance when he should have 20. What could i do to prevent this from happening ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---