better fix for lockfile

This commit is contained in:
Kay0u 2020-01-07 01:15:26 +08:00
parent 1bf566401d
commit 6a5971bb3c
No known key found for this signature in database
GPG key ID: 7FF262C033518333
2 changed files with 4 additions and 2 deletions

View file

@ -454,12 +454,14 @@ class MoulinetteLock(object):
"""
base_lockfile = "/var/run/moulinette_%s.lock"
def __init__(self, namespace, timeout=None, interval=0.5):
self.namespace = namespace
self.timeout = timeout
self.interval = interval
self._lockfile = "/var/run/moulinette_%s.lock" % namespace
self._lockfile = self.base_lockfile % namespace
self._stale_checked = False
self._locked = False

View file

@ -80,7 +80,7 @@ def patch_logging(moulinette):
def patch_lock(moulinette):
moulinette.core.MoulinetteLock._lock = lambda *args: None
moulinette.core.MoulinetteLock.base_lockfile = "moulinette_%s.lock"
@pytest.fixture(scope="session", autouse=True)