Files
motia/bitbylaw/steps/advoware_cal_sync/calendar_sync_cron_step.py

38 lines
1.0 KiB
Python

import json
config = {
'type': 'cron',
'name': 'Calendar Sync Cron Job',
'description': 'Führt den Calendar Sync alle 15 Minuten automatisch aus',
'cron': '*/15 * * * *', # Alle 15 Minuten
'emits': ['calendar.sync.triggered']
}
async def handler(event, context):
try:
context.logger.info("Calendar Sync Cron: Starte automatische Synchronisation alle 15 Minuten")
# Emit Event für den Sync
await context.emit({
"topic": "calendar.sync.triggered",
"data": {
"body": {
"full_content": True, # Cron verwendet immer volle Details
"triggered_by": "cron"
}
}
})
context.logger.info("Calendar Sync Cron: Event wurde emittiert")
return {
'status': 'completed',
'triggered_by': 'cron'
}
except Exception as e:
context.logger.error(f"Fehler beim Cron-Job: {e}")
return {
'status': 'error',
'error': str(e)
}