diff --git a/invokeai/backend/model_manager/download/model_queue.py b/invokeai/backend/model_manager/download/model_queue.py index 2aded8d3ae..1c2e976616 100644 --- a/invokeai/backend/model_manager/download/model_queue.py +++ b/invokeai/backend/model_manager/download/model_queue.py @@ -217,8 +217,8 @@ class ModelDownloadQueue(DownloadQueue): return assert isinstance(job, DownloadJobRepoID) - self._update_job_status(job, DownloadJobStatus.RUNNING) self._lock.acquire() # prevent status from being updated while we are setting up subqueue + self._update_job_status(job, DownloadJobStatus.RUNNING) try: job.subqueue = self.__class__( event_handlers=[subdownload_event], diff --git a/invokeai/backend/model_manager/download/queue.py b/invokeai/backend/model_manager/download/queue.py index 2b3a351e1d..b36066c90f 100644 --- a/invokeai/backend/model_manager/download/queue.py +++ b/invokeai/backend/model_manager/download/queue.py @@ -402,7 +402,8 @@ class DownloadQueue(DownloadQueueBase): raise excp except Exception as excp: job.error = excp - self._update_job_status(job, DownloadJobStatus.ERROR) + if job.status != DownloadJobStatus.ERROR: # let handlers know, but don't cause infinite recursion + self._update_job_status(job, DownloadJobStatus.ERROR) def _download_path(self, job: DownloadJobBase): """Call when the source is a Path or pathlike object.""" diff --git a/tests/AC_model_manager/test_model_install_service.py b/tests/AC_model_manager/test_model_install_service.py index 8f7c9b8378..055f9eeeae 100644 --- a/tests/AC_model_manager/test_model_install_service.py +++ b/tests/AC_model_manager/test_model_install_service.py @@ -55,7 +55,7 @@ def test_install(datadir: Path): mm_install = ModelInstallService(config=config, store=mm_store, event_bus=event_bus) source = datadir / TEST_MODEL - job = mm_install.install_model(source=source) + mm_install.install_model(source) id_map = mm_install.wait_for_installs() print(id_map) assert source in id_map, "model did not install; id_map empty"