mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Refactor gunicorn.conf.py and main.py to use RUN_DIR instead of TMP_DIR for storing PID file
This commit is contained in:
parent
500012fc54
commit
e865de71a2
2 changed files with 5 additions and 3 deletions
|
|
@ -18,6 +18,7 @@ from logger import setup_logger # type: ignore
|
|||
from src.User import User
|
||||
|
||||
TMP_DIR = Path(sep, "var", "tmp", "bunkerweb")
|
||||
RUN_DIR = Path(sep, "var", "run", "bunkerweb")
|
||||
|
||||
MAX_WORKERS = int(getenv("MAX_WORKERS", max((cpu_count() or 1) - 1, 1)))
|
||||
LOG_LEVEL = getenv("LOG_LEVEL", "info")
|
||||
|
|
@ -110,10 +111,11 @@ def on_starting(server):
|
|||
|
||||
|
||||
def when_ready(server):
|
||||
TMP_DIR.joinpath("ui.pid").write_text(str(getpid()), encoding="utf-8")
|
||||
RUN_DIR.mkdir(parents=True, exist_ok=True)
|
||||
RUN_DIR.joinpath("ui.pid").write_text(str(getpid()), encoding="utf-8")
|
||||
TMP_DIR.joinpath("ui.healthy").write_text("ok", encoding="utf-8")
|
||||
|
||||
|
||||
def on_exit(server):
|
||||
TMP_DIR.joinpath("ui.pid").unlink(missing_ok=True)
|
||||
RUN_DIR.joinpath("ui.pid").unlink(missing_ok=True)
|
||||
TMP_DIR.joinpath("ui.healthy").unlink(missing_ok=True)
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ def stop_gunicorn():
|
|||
|
||||
|
||||
def stop(status, _stop=True):
|
||||
TMP_DIR.joinpath("ui.pid").unlink(missing_ok=True)
|
||||
Path(sep, "var", "run", "bunkerweb", "ui.pid").unlink(missing_ok=True)
|
||||
TMP_DIR.joinpath("ui.healthy").unlink(missing_ok=True)
|
||||
if _stop is True:
|
||||
stop_gunicorn()
|
||||
|
|
|
|||
Loading…
Reference in a new issue