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
|
return
|
||||||
|
|
||||||
assert isinstance(job, DownloadJobRepoID)
|
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._lock.acquire() # prevent status from being updated while we are setting up subqueue
|
||||||
|
self._update_job_status(job, DownloadJobStatus.RUNNING)
|
||||||
try:
|
try:
|
||||||
job.subqueue = self.__class__(
|
job.subqueue = self.__class__(
|
||||||
event_handlers=[subdownload_event],
|
event_handlers=[subdownload_event],
|
||||||
|
@ -402,7 +402,8 @@ class DownloadQueue(DownloadQueueBase):
|
|||||||
raise excp
|
raise excp
|
||||||
except Exception as excp:
|
except Exception as excp:
|
||||||
job.error = 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):
|
def _download_path(self, job: DownloadJobBase):
|
||||||
"""Call when the source is a Path or pathlike object."""
|
"""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)
|
mm_install = ModelInstallService(config=config, store=mm_store, event_bus=event_bus)
|
||||||
|
|
||||||
source = datadir / TEST_MODEL
|
source = datadir / TEST_MODEL
|
||||||
job = mm_install.install_model(source=source)
|
mm_install.install_model(source)
|
||||||
id_map = mm_install.wait_for_installs()
|
id_map = mm_install.wait_for_installs()
|
||||||
print(id_map)
|
print(id_map)
|
||||||
assert source in id_map, "model did not install; id_map empty"
|
assert source in id_map, "model did not install; id_map empty"
|
||||||
|
Loading…
Reference in New Issue
Block a user