diff --git a/frontend/src/components/System.tsx b/frontend/src/components/System.tsx index a81e993..019c465 100644 --- a/frontend/src/components/System.tsx +++ b/frontend/src/components/System.tsx @@ -210,7 +210,7 @@ export default function System() { : "Sync Failed"} - {operation.trigger_type} + {operation.trigger_type.charAt(0).toUpperCase() + operation.trigger_type.slice(1)}
@@ -272,7 +272,7 @@ export default function System() { : "Sync Failed"} - {operation.trigger_type} + {operation.trigger_type.charAt(0).toUpperCase() + operation.trigger_type.slice(1)}
diff --git a/leggen/api/models/sync.py b/leggen/api/models/sync.py index abea474..ac03da3 100644 --- a/leggen/api/models/sync.py +++ b/leggen/api/models/sync.py @@ -18,7 +18,7 @@ class SyncOperation(BaseModel): duration_seconds: Optional[float] = None errors: list[str] = [] logs: list[str] = [] - trigger_type: str = "manual" # manual, scheduled, api + trigger_type: str = "manual" # manual, scheduled, retry, api class Config: json_encoders = {datetime: lambda v: v.isoformat() if v else None} diff --git a/leggen/background/scheduler.py b/leggen/background/scheduler.py index bfd380a..bbbcec3 100644 --- a/leggen/background/scheduler.py +++ b/leggen/background/scheduler.py @@ -102,12 +102,14 @@ class BackgroundScheduler: async def _run_sync(self, retry_count: int = 0): """Run sync with enhanced error handling and retry logic""" try: - logger.info("Starting scheduled sync job") - await self.sync_service.sync_all_accounts() - logger.info("Scheduled sync job completed successfully") + trigger_type = "retry" if retry_count > 0 else "scheduled" + logger.info(f"Starting {trigger_type} sync job") + await self.sync_service.sync_all_accounts(trigger_type=trigger_type) + logger.info(f"{trigger_type.capitalize()} sync job completed successfully") except Exception as e: + trigger_type = "retry" if retry_count > 0 else "scheduled" logger.error( - f"Scheduled sync job failed (attempt {retry_count + 1}/{self.max_retries}): {e}" + f"{trigger_type.capitalize()} sync job failed (attempt {retry_count + 1}/{self.max_retries}): {e}" ) # Send notification about the failure