diff --git a/snappea/foreman.py b/snappea/foreman.py index a09fa14..0c587b3 100644 --- a/snappea/foreman.py +++ b/snappea/foreman.py @@ -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