fix: replace return dicts with raise in calendar_sync_all queue handler – enables Motia retry on failure

This commit is contained in:
bsiggel
2026-03-31 06:57:17 +00:00
parent 4ed6259ed9
commit 7a0ebb949d

View File

@@ -49,7 +49,7 @@ async def handler(input_data: Dict[str, Any], ctx: FlowContext) -> None:
employees = await get_advoware_employees(advoware, ctx) employees = await get_advoware_employees(advoware, ctx)
if not employees: if not employees:
log_operation('error', "Keine Mitarbeiter gefunden. All-Sync abgebrochen.", context=ctx) log_operation('error', "Keine Mitarbeiter gefunden. All-Sync abgebrochen.", context=ctx)
return {'status': 500, 'body': {'error': 'Keine Mitarbeiter gefunden'}} raise RuntimeError("Keine Mitarbeiter gefunden. All-Sync abgebrochen.")
redis_client = get_redis_client(ctx) redis_client = get_redis_client(ctx)
@@ -99,15 +99,7 @@ async def handler(input_data: Dict[str, Any], ctx: FlowContext) -> None:
emitted_count += 1 emitted_count += 1
log_operation('info', f"Calendar Sync All: Completed, emitted {emitted_count} events", context=ctx) log_operation('info', f"Calendar Sync All: Completed, emitted {emitted_count} events", context=ctx)
return {
'status': 'completed',
'triggered_by': triggered_by,
'emitted_count': emitted_count
}
except Exception as e: except Exception as e:
log_operation('error', f"Fehler beim All-Sync: {e}", context=ctx) log_operation('error', f"Fehler beim All-Sync: {e}", context=ctx)
return { raise
'status': 'error',
'error': str(e)
}