From 23902ce8dfc9065ed32a5bba22394a403055119f Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Tue, 4 Aug 2009 13:31:00 +0000 Subject: [PATCH] do not whine if locked by the same process before... BUG:FIXED:10568 --- pisi/api.py | 5 ++++- pisi/context.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pisi/api.py b/pisi/api.py index 8d4a5cb9..94872324 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -62,8 +62,10 @@ def locked(func): try: fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB) + ctx.locked = True except IOError: - raise pisi.errors.AnotherInstanceError(_("Another instance of PiSi is running. Only one instance is allowed.")) + if not ctx.locked: + raise pisi.errors.AnotherInstanceError(_("Another instance of PiSi is running. Only one instance is allowed.")) try: pisi.db.invalidate_caches() @@ -71,6 +73,7 @@ def locked(func): pisi.db.update_caches() return ret finally: + ctx.locked = False lock.close() return wrapper diff --git a/pisi/context.py b/pisi/context.py index d5e59e6f..06ee4c84 100644 --- a/pisi/context.py +++ b/pisi/context.py @@ -25,6 +25,8 @@ config = None log = None +locked = False + def set_option(opt, val): config.set_option(opt, val)