diff --git a/bitbylaw/steps/advoware_cal_sync/calendar_sync_event_step.py b/bitbylaw/steps/advoware_cal_sync/calendar_sync_event_step.py index 28ad1fe7..e1ebbef3 100644 --- a/bitbylaw/steps/advoware_cal_sync/calendar_sync_event_step.py +++ b/bitbylaw/steps/advoware_cal_sync/calendar_sync_event_step.py @@ -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