From c4654d77623477bbae0b86b0cb841bd8595593fb Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 15 Aug 2024 22:14:50 -0400 Subject: [PATCH] fix: Fix __del__ and rename create_processes to setup (#18) --- src/retsu/core.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/retsu/core.py b/src/retsu/core.py index d8a2a74..8d47bf3 100644 --- a/src/retsu/core.py +++ b/src/retsu/core.py @@ -41,7 +41,6 @@ def __init__(self, workers: int = 1) -> None: def __del__(self) -> None: """Close queues and process.""" logging.info(f"Deleting process {self.__class__.__name__}") - self.stop() @public def start(self) -> None: @@ -145,13 +144,13 @@ def __init__(self) -> None: self.tasks: dict[str, Process] = {} @public - def create_processes(self) -> None: + def setup(self) -> None: """Get a process with the given name.""" if self.tasks: return warnings.warn( - "`self.tasks` is empty. Override `create_processes` and create " + "`self.tasks` is empty. Override `setup` and create " "`self.tasks` with the proper tasks." ) @@ -164,7 +163,7 @@ def get_process(self, name: str) -> Optional[Process]: def start(self) -> None: """Start tasks.""" if not self.tasks: - self.create_processes() + self.setup() for task_name, process in self.tasks.items(): process.start()