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:
@@ -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)}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user