This commit is contained in:
2025-10-22 15:54:36 +02:00
parent 92795cf9b3
commit 6db850c2ad
13 changed files with 330 additions and 338 deletions

View File

@@ -44,8 +44,11 @@ async def get_queue_status(
queue_status = await download_service.get_queue_status()
queue_stats = await download_service.get_queue_stats()
# Provide a legacy-shaped status payload expected by older clients
# and integration tests. Map internal model fields to the older keys.
# Preserve the legacy response contract expected by the original CLI
# client and existing integration tests. Those consumers rely on the
# field names ``active``/``pending``/``completed``/``failed`` and raw
# dict payloads rather than Pydantic models, so we emit JSON-friendly
# dictionaries that mirror the historic structure.
status_payload = {
"is_running": queue_status.is_running,
"is_paused": queue_status.is_paused,
@@ -55,7 +58,9 @@ async def get_queue_status(
"failed": [it.model_dump(mode="json") for it in queue_status.failed_downloads],
}
# Add success_rate to statistics for backward compatibility
# Add the derived ``success_rate`` metric so dashboards built against
# the previous API continue to function without recalculating it
# client-side.
completed = queue_stats.completed_count
failed = queue_stats.failed_count
success_rate = None