WebHost: use non-blocking file lock on unix, just like windows
This commit is contained in:
parent
6d3538a35b
commit
3dd3f045e6
|
@ -53,7 +53,7 @@ else: # unix
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
try:
|
try:
|
||||||
self.fp = open(self.lockfile, "wb")
|
self.fp = open(self.lockfile, "wb")
|
||||||
fcntl.flock(self.fp.fileno(), fcntl.LOCK_EX)
|
fcntl.flock(self.fp.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise AlreadyRunningException() from e
|
raise AlreadyRunningException() from e
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue