mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-14 02:42:21 +00:00
fix: Correct sync trigger types from manual to scheduled/retry.
Fixed scheduled syncs being incorrectly saved as "manual" in database. Now properly identifies scheduled syncs as "scheduled" and retry attempts as "retry". Updated frontend to capitalize trigger type badges for better display. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -210,7 +210,7 @@ export default function System() {
|
|||||||
: "Sync Failed"}
|
: "Sync Failed"}
|
||||||
</h4>
|
</h4>
|
||||||
<Badge variant="outline" className="text-xs">
|
<Badge variant="outline" className="text-xs">
|
||||||
{operation.trigger_type}
|
{operation.trigger_type.charAt(0).toUpperCase() + operation.trigger_type.slice(1)}
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center space-x-4 mt-1 text-xs text-muted-foreground">
|
<div className="flex items-center space-x-4 mt-1 text-xs text-muted-foreground">
|
||||||
@@ -272,7 +272,7 @@ export default function System() {
|
|||||||
: "Sync Failed"}
|
: "Sync Failed"}
|
||||||
</h4>
|
</h4>
|
||||||
<Badge variant="outline" className="text-xs mt-1">
|
<Badge variant="outline" className="text-xs mt-1">
|
||||||
{operation.trigger_type}
|
{operation.trigger_type.charAt(0).toUpperCase() + operation.trigger_type.slice(1)}
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class SyncOperation(BaseModel):
|
|||||||
duration_seconds: Optional[float] = None
|
duration_seconds: Optional[float] = None
|
||||||
errors: list[str] = []
|
errors: list[str] = []
|
||||||
logs: list[str] = []
|
logs: list[str] = []
|
||||||
trigger_type: str = "manual" # manual, scheduled, api
|
trigger_type: str = "manual" # manual, scheduled, retry, api
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
json_encoders = {datetime: lambda v: v.isoformat() if v else None}
|
json_encoders = {datetime: lambda v: v.isoformat() if v else None}
|
||||||
|
|||||||
@@ -102,12 +102,14 @@ class BackgroundScheduler:
|
|||||||
async def _run_sync(self, retry_count: int = 0):
|
async def _run_sync(self, retry_count: int = 0):
|
||||||
"""Run sync with enhanced error handling and retry logic"""
|
"""Run sync with enhanced error handling and retry logic"""
|
||||||
try:
|
try:
|
||||||
logger.info("Starting scheduled sync job")
|
trigger_type = "retry" if retry_count > 0 else "scheduled"
|
||||||
await self.sync_service.sync_all_accounts()
|
logger.info(f"Starting {trigger_type} sync job")
|
||||||
logger.info("Scheduled sync job completed successfully")
|
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:
|
except Exception as e:
|
||||||
|
trigger_type = "retry" if retry_count > 0 else "scheduled"
|
||||||
logger.error(
|
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
|
# Send notification about the failure
|
||||||
|
|||||||
Reference in New Issue
Block a user