Skip to content

Commit

Permalink
install simple signal handler
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Büchse <[email protected]>
  • Loading branch information
mbuechse committed Sep 6, 2024
1 parent 71c73c6 commit 51edc42
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions compliance-monitor/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import os.path
from shutil import which
import signal
from subprocess import run
from tempfile import NamedTemporaryFile
# _thread: low-level library, but (contrary to the name) not private
Expand Down Expand Up @@ -677,6 +678,11 @@ def verdict_check_filter(value):
return {1: '✔', -1: '✘'}.get(value, '⚠')


def sighup_handler(signum, frame):
with _scopes_lock:
_scopes['_counter'] += 1


if __name__ == "__main__":
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
env.filters.update(
Expand All @@ -695,4 +701,5 @@ def verdict_check_filter(value):
_ = get_scopes() # make sure they can be read
import_templates(settings.template_path, env=env, templates=templates_map)
validate_templates(templates=templates_map)
signal.signal(signal.SIGUSR2, sighup_handler)
uvicorn.run(app, host='0.0.0.0', port=8080, log_level="info", workers=1)

0 comments on commit 51edc42

Please sign in to comment.