fix race condition between downloading last file and starting install

This commit is contained in:
Lincoln Stein
2024-02-29 15:08:10 -05:00
committed by psychedelicious
parent e18533e3b5
commit 813a086cfe
7 changed files with 18 additions and 36 deletions

View File

@ -166,6 +166,7 @@ def test_broken_callbacks(tmp_path: Path, session: Session, capsys) -> None:
# assert re.search("division by zero", captured.err)
queue.stop()
@pytest.mark.timeout(timeout=15, method="thread")
def test_cancel(tmp_path: Path, session: Session) -> None:
event_bus = TestEventService()

View File

@ -220,6 +220,7 @@ def test_simple_download(mm2_installer: ModelInstallServiceBase, mm2_app_config:
event_names = [x.event_name for x in bus.events]
assert event_names == ["model_install_downloading", "model_install_running", "model_install_completed"]
@pytest.mark.timeout(timeout=20, method="thread")
def test_huggingface_download(mm2_installer: ModelInstallServiceBase, mm2_app_config: InvokeAIAppConfig) -> None:
source = URLModelSource(url=Url("https://huggingface.co/stabilityai/sdxl-turbo"))

View File

@ -2,6 +2,7 @@
import os
import shutil
import time
from pathlib import Path
from typing import Any, Dict, List
@ -149,6 +150,7 @@ def mm2_installer(
def stop_installer() -> None:
installer.stop()
time.sleep(0.1) # avoid error message from the logger when it is closed before thread prints final message
request.addfinalizer(stop_installer)
return installer