From 7f75f6226b035ff45958dc1f0712b443034481b2 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 20 Feb 2024 18:05:52 +1100 Subject: [PATCH] tidy(bulk_download): don't store events service separately Using the invoker object directly leaves no ambiguity as to what `_events_bus` actually is. --- .../services/bulk_download/bulk_download_default.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/invokeai/app/services/bulk_download/bulk_download_default.py b/invokeai/app/services/bulk_download/bulk_download_default.py index 9fad0c3443..04cec928f4 100644 --- a/invokeai/app/services/bulk_download/bulk_download_default.py +++ b/invokeai/app/services/bulk_download/bulk_download_default.py @@ -21,7 +21,6 @@ from .bulk_download_base import BulkDownloadBase class BulkDownloadService(BulkDownloadBase): def start(self, invoker: Invoker) -> None: self._invoker = invoker - self._event_bus = invoker.services.events def __init__(self): self._temp_directory = TemporaryDirectory() @@ -104,9 +103,9 @@ class BulkDownloadService(BulkDownloadBase): self, bulk_download_id: str, bulk_download_item_id: str, bulk_download_item_name: str ) -> None: """Signal that a bulk download job has started.""" - if self._event_bus: + if self._invoker: assert bulk_download_id is not None - self._event_bus.emit_bulk_download_started( + self._invoker.services.events.emit_bulk_download_started( bulk_download_id=bulk_download_id, bulk_download_item_id=bulk_download_item_id, bulk_download_item_name=bulk_download_item_name, @@ -116,10 +115,10 @@ class BulkDownloadService(BulkDownloadBase): self, bulk_download_id: str, bulk_download_item_id: str, bulk_download_item_name: str ) -> None: """Signal that a bulk download job has completed.""" - if self._event_bus: + if self._invoker: assert bulk_download_id is not None assert bulk_download_item_name is not None - self._event_bus.emit_bulk_download_completed( + self._invoker.services.events.emit_bulk_download_completed( bulk_download_id=bulk_download_id, bulk_download_item_id=bulk_download_item_id, bulk_download_item_name=bulk_download_item_name, @@ -129,10 +128,10 @@ class BulkDownloadService(BulkDownloadBase): self, bulk_download_id: str, bulk_download_item_id: str, bulk_download_item_name: str, exception: Exception ) -> None: """Signal that a bulk download job has failed.""" - if self._event_bus: + if self._invoker: assert bulk_download_id is not None assert exception is not None - self._event_bus.emit_bulk_download_failed( + self._invoker.services.events.emit_bulk_download_failed( bulk_download_id=bulk_download_id, bulk_download_item_id=bulk_download_item_id, bulk_download_item_name=bulk_download_item_name,