On 3/14/07, tml <[EMAIL PROTECTED]> wrote:
> I'm using SA and have a visit counter for user profiles and some other
> pages. I have a visit_counter column in User object, and usually do
> User.get(id).visit_counter+=1
>
> But I realize this is a race if all the threads are serving the same
> page. Can someone tell how to do this right?

If your database implements ACID features (pretty much all?) then it
will ensure that the race is prevented.

You can test this by opening two tg shells -- you will see that if
they both access the same row, the second one will freeze until the
first one's transaction ends.

Regards -- Andy

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to