Push get_pc_registry into snappea.foreman init

This commit is contained in:
Klaas van Schelven
2024-05-23 10:12:24 +02:00
parent 093f81f2f2
commit 82d40e3741

View File

@@ -118,6 +118,13 @@ class Foreman:
# stops. (the value of this semaphore is implicitly NUM_WORKERS - active_workers)
self.worker_semaphore = threading.Semaphore(self.settings.NUM_WORKERS)
# "initialize" the application.
# this is likely in the wrong place, but I want to have it "somewhere" (before the workers start). And thinking
# of the right place is something I want to postpone (it's also something we need to do for gunicorn, where it's
# even harder because multi-process means the n (number of workers) don't share the same instance.
from bugsink.registry import get_pc_registry
get_pc_registry()
def run_in_thread(self, task_id, function, *args, **kwargs):
# NOTE: we expose args & kwargs in the logs; as it stands no sensitive stuff lives there in our case, but this
# is something to keep an eye on