mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Webhost: Fix autohost lock on unix
This commit is contained in:
@@ -45,8 +45,8 @@ else: # unix
|
|||||||
|
|
||||||
class Locker(CommonLocker):
|
class Locker(CommonLocker):
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self.fp = open(self.lockfile, "rb")
|
|
||||||
try:
|
try:
|
||||||
|
self.fp = open(self.lockfile, "wb")
|
||||||
fcntl.flock(self.fp.fileno(), fcntl.LOCK_EX)
|
fcntl.flock(self.fp.fileno(), fcntl.LOCK_EX)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise AlreadyRunningException() from e
|
raise AlreadyRunningException() from e
|
||||||
@@ -72,6 +72,7 @@ def autohost(config: dict):
|
|||||||
def keep_running():
|
def keep_running():
|
||||||
try:
|
try:
|
||||||
with Locker("autohost"):
|
with Locker("autohost"):
|
||||||
|
logging.info("Starting autohost service")
|
||||||
# db.bind(**config["PONY"])
|
# db.bind(**config["PONY"])
|
||||||
# db.generate_mapping(check_tables=False)
|
# db.generate_mapping(check_tables=False)
|
||||||
while 1:
|
while 1:
|
||||||
|
Reference in New Issue
Block a user