1
0
Fork 1
mirror of https://github.com/thatmattlove/hyperglass.git synced 2026-01-17 08:48:05 +00:00

improve state handling & logging

This commit is contained in:
thatmattlove 2024-03-01 23:18:11 -05:00
parent 9e6e0d55ee
commit 92bc28ac05

View file

@ -118,14 +118,15 @@ def when_ready(server: "Arbiter") -> None:
def on_exit(_: t.Any) -> None:
"""Gunicorn shutdown tasks."""
log.critical("Stopping hyperglass {}", __version__)
state = use_state()
if not Settings.dev_mode:
state.clear()
state.clear()
log.info("Cleared hyperglass state")
unregister_all_plugins()
log.critical("Stopping hyperglass {}", __version__)
class HyperglassWSGI(BaseApplication):
"""Custom gunicorn app."""
@ -185,6 +186,9 @@ def run(_workers: int = None):
try:
log.debug("System settings: {!r}", Settings)
state = use_state()
state.clear()
init_user_config()
workers = 1 if Settings.debug else cpu_count(2)