[damned-lies] Lock at module level when updating stats



commit d6aa5fdf8c3d2e48414412596d545d5930f2f82a
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat Apr 18 15:47:54 2009 +0200

    Lock at module level when updating stats
    
    git shares a single filesystem for all branches.
---
 stats/management/commands/update-stats.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stats/management/commands/update-stats.py b/stats/management/commands/update-stats.py
index afa0ad7..993fa6e 100644
--- a/stats/management/commands/update-stats.py
+++ b/stats/management/commands/update-stats.py
@@ -78,7 +78,7 @@ class Command(BaseCommand):
     # Weird things happen when multiple updates run in parallel for the same module
     # We use filesystem directories creation/deletion to act as global lock mecanism
     def get_lock_for_module(self, module_name, branch_name):
-        dirpath = os.path.join("/tmp", "updating-%s-%s" % (module_name, branch_name))
+        dirpath = os.path.join("/tmp", "updating-%s" % (module_name,))
         while True:
             try:
                 os.mkdir(dirpath)
@@ -88,6 +88,6 @@ class Command(BaseCommand):
         return # Lock acquired
 
     def release_lock_for_module(self, module_name, branch_name):
-        dirpath = os.path.join("/tmp", "updating-%s-%s" % (module_name, branch_name))
+        dirpath = os.path.join("/tmp", "updating-%s" % (module_name,))
         os.rmdir(dirpath)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]