Fix emit_progress AttributeError

Replace non-existent emit_progress calls with proper ProgressService methods:
- start_progress for starting operations
- update_progress for progress updates
- complete_progress for successful completion
- fail_progress for failures

Convert percentage-based updates to current/total based on ProgressService API
This commit is contained in:
2026-01-23 15:06:49 +01:00
parent f89649fe20
commit c586e9f69d
2 changed files with 42 additions and 72 deletions

View File

@@ -156,24 +156,34 @@ async def setup_auth(req: SetupRequest):
await perform_nfo_scan_if_needed(progress_service)
# Send completion event
progress_service.emit_progress(
from src.server.services.progress_service import ProgressType
await progress_service.start_progress(
progress_id="initialization_complete",
progress_type="system",
status="completed",
progress_type=ProgressType.SYSTEM,
title="Initialization Complete",
total=100,
message="All initialization tasks completed successfully",
metadata={"initialization_complete": True}
)
await progress_service.complete_progress(
progress_id="initialization_complete",
message="All initialization tasks completed successfully",
percent=100,
metadata={"initialization_complete": True}
)
except Exception as e:
# Send error event
progress_service.emit_progress(
from src.server.services.progress_service import ProgressType
await progress_service.start_progress(
progress_id="initialization_error",
progress_type="error",
status="failed",
progress_type=ProgressType.ERROR,
title="Initialization Failed",
total=100,
message=str(e),
percent=0,
metadata={"initialization_complete": True, "error": str(e)}
)
await progress_service.fail_progress(
progress_id="initialization_error",
error_message=str(e),
metadata={"initialization_complete": True, "error": str(e)}
)