On Mon, 2006-10-30 at 22:26 -0300, Jorge Godoy wrote: > Stuart Clarke <[EMAIL PROTECTED]> writes: > > > I have a script which accesses the DB, and which can be started in the > > background from my TG web application (The script also uses my app's > > model). I want to prevent this script from being simultaneously > > executed more than once. Problem is, the web app may be replicated > > across a number of load-balanced servers. So, what mechanism can I use > > to prevent simultaneous execution. The only things shared by my > > replicated apps would be the DB server, and memcached. > > Use a table with a flag. Check that before starting and if it's there, abort > the execution. If it's not, then start your operation by setting the flag so > that no other instance of the script can be run.
*** The test-and-set operation isn't atomic though, is it? Which still leaves the door (slightly) open for simultaneous executions. Might be the best possible solution, however. Thanks, Stuart --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

