do not whine if locked by the same process before...

BUG:FIXED:10568
This commit is contained in:
Faik Uygur
2009-08-04 13:31:00 +00:00
parent 0596e307de
commit 23902ce8df
2 changed files with 6 additions and 1 deletions
+4 -1
View File
@@ -62,8 +62,10 @@ def locked(func):
try: try:
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB) fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
ctx.locked = True
except IOError: 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: try:
pisi.db.invalidate_caches() pisi.db.invalidate_caches()
@@ -71,6 +73,7 @@ def locked(func):
pisi.db.update_caches() pisi.db.update_caches()
return ret return ret
finally: finally:
ctx.locked = False
lock.close() lock.close()
return wrapper return wrapper
+2
View File
@@ -25,6 +25,8 @@ config = None
log = None log = None
locked = False
def set_option(opt, val): def set_option(opt, val):
config.set_option(opt, val) config.set_option(opt, val)