fix: derive worker shutdown wait from timeout budget

Co-authored-by: Copilot App <[email protected]>
This commit is contained in:
Jim Lancaster
2026-08-23 18:32:40 -05:00
co-authored by Copilot App
parent 86cdb4035c
commit f9261a1af3
8 changed files with 28 additions and 1 deletions
+5
View File
@@ -28,6 +28,7 @@ class TestAppLifespan:
def test_startup_initializes_runtime_dependencies(self, monkeypatch, tmp_path):
"""Startup initializes logging, schema, directories, and worker resources."""
calls = []
worker_kwargs = {}
monkeypatch.setattr("transcription.app.configure_logging", lambda _settings: calls.append("logging"))
monkeypatch.setattr("transcription.app.register_pages", lambda _app: None)
@@ -53,6 +54,7 @@ class TestAppLifespan:
@asynccontextmanager
async def _worker_lifespan(**_kwargs):
worker_kwargs.update(_kwargs)
calls.append("worker_start")
yield object(), object(), object()
calls.append("worker_stop")
@@ -78,6 +80,9 @@ class TestAppLifespan:
assert "worker_start" in calls
assert "worker_stop" in calls
assert "dispose_db" in calls
assert worker_kwargs["shutdown_timeout_seconds"] == pytest.approx(
settings.worker_provider_timeout_seconds + settings.worker_shutdown_grace_seconds
)
assert settings.upload_dir.exists()
assert settings.prompt_dir.exists()