diff --git a/services/job_registry.py b/services/job_registry.py index 68e6a3461..f2e14e98c 100644 --- a/services/job_registry.py +++ b/services/job_registry.py @@ -63,10 +63,15 @@ def __new__(cls) -> "JobRegistry": # כדי למנוע race condition שבו thread אחר רואה instance # אבל _jobs עדיין לא קיים new_instance = super().__new__(cls) - new_instance._jobs: Dict[str, JobDefinition] = {} + new_instance._jobs = {} # type annotation in __init__ cls._instance = new_instance return cls._instance + def __init__(self) -> None: + """Initialize the instance (only once)""" + if not hasattr(self, '_jobs'): + self._jobs: Dict[str, JobDefinition] = {} + def register(self, job: JobDefinition) -> None: """רישום Job חדש""" self._jobs[job.job_id] = job