API-Schutz: 100ms Verzögerung bei allen Google API Calls (create, update, delete)

This commit is contained in:
root
2025-10-24 19:58:18 +00:00
parent 2bf37b8616
commit dcb2dba50f

View File

@@ -480,6 +480,7 @@ async def create_google_event(service, calendar_id, data, context=None):
created = service.events().insert(calendarId=calendar_id, body=event_body).execute()
event_id = created['id']
log_operation('info', f"Created Google event ID: {event_id}", context=context)
await asyncio.sleep(0.1) # Rate limit protection: 100ms delay after each Google API call
return event_id
except HttpError as e:
log_operation('error', f"Google API error creating event: {e}", context=context)
@@ -513,6 +514,7 @@ async def update_google_event(service, calendar_id, event_id, data, context=None
try:
service.events().update(calendarId=calendar_id, eventId=event_id, body=event_body).execute()
log_operation('info', f"Updated Google event ID: {event_id}", context=context)
await asyncio.sleep(0.1) # Rate limit protection: 100ms delay after each Google API call
except HttpError as e:
log_operation('error', f"Google API error updating event {event_id}: {e}", context=context)
raise
@@ -526,6 +528,7 @@ async def delete_google_event(service, calendar_id, event_id, context=None):
try:
service.events().delete(calendarId=calendar_id, eventId=event_id).execute()
log_operation('info', f"Deleted Google event ID: {event_id}", context=context)
await asyncio.sleep(0.1) # Rate limit protection: 100ms delay after each Google API call
except HttpError as e:
log_operation('error', f"Google API error deleting event {event_id}: {e}", context=context)
raise