Skip to content

Commit 9e38076

Browse files
committed
fix (development): polling state storage
1 parent 45a616e commit 9e38076

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/server/main/integrations/routes.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,19 @@ async def connect_oauth_integration(request: OAuthConnectRequest, user_id: str =
131131
success = await mongo_manager.update_user_profile(user_id, update_payload)
132132
if not success:
133133
raise HTTPException(status_code=500, detail="Failed to save integration credentials.")
134+
135+
# Create the polling state document to enable the poller for this service
136+
if service_name == 'gmail' or service_name == 'gcalendar':
137+
await mongo_manager.update_polling_state(
138+
user_id,
139+
service_name,
140+
{
141+
"is_enabled": True,
142+
"is_currently_polling": False,
143+
"next_scheduled_poll_time": datetime.datetime.now(datetime.timezone.utc), # Poll immediately
144+
"last_successful_poll_timestamp_unix": None,
145+
}
146+
)
134147

135148
return JSONResponse(content={"message": f"{service_name} connected successfully."})
136149

0 commit comments

Comments
 (0)