mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
prevent potential infinite recursion on exceptions raised by event handlers
This commit is contained in:
parent
0f9c676fcb
commit
53e1199902
@ -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],
|
||||
|
@ -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."""
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user