From de94f67f7b7ae617aa4aa168c621e1836617d698 Mon Sep 17 00:00:00 2001 From: Harshith Mullapudi Date: Mon, 1 Sep 2025 19:17:26 +0530 Subject: [PATCH] fix: timeout in space assignment and return response in add --- apps/webapp/app/routes/api.v1.add.tsx | 4 ++-- apps/webapp/app/trigger/spaces/space-assignment.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/webapp/app/routes/api.v1.add.tsx b/apps/webapp/app/routes/api.v1.add.tsx index 2fcc5b1..1bd9533 100644 --- a/apps/webapp/app/routes/api.v1.add.tsx +++ b/apps/webapp/app/routes/api.v1.add.tsx @@ -14,8 +14,8 @@ const { action, loader } = createHybridActionApiRoute( corsStrategy: "all", }, async ({ body, authentication }) => { - const response = addToQueue(body, authentication.userId); - return json({ ...response }); + const response = await addToQueue(body, authentication.userId); + return json({ success: true, id: response.id }); }, ); diff --git a/apps/webapp/app/trigger/spaces/space-assignment.ts b/apps/webapp/app/trigger/spaces/space-assignment.ts index 7f80b6a..2471a24 100644 --- a/apps/webapp/app/trigger/spaces/space-assignment.ts +++ b/apps/webapp/app/trigger/spaces/space-assignment.ts @@ -174,7 +174,7 @@ async function checkAndTriggerSpacePatterns( export const spaceAssignmentTask = task({ id: "space-assignment", - maxDuration: 900, // 15 minutes timeout + maxDuration: 1800, // 15 minutes timeout run: async (payload: SpaceAssignmentPayload) => { const { userId, @@ -550,7 +550,7 @@ async function processBatchAI( requests: batchRequests, outputSchema: AssignmentResultSchema, maxRetries: 3, - timeoutMs: 600000, // 10 minutes timeout + timeoutMs: 1200000, // 10 minutes timeout }); logger.info(`Batch AI job created: ${batchId}`, { @@ -560,7 +560,7 @@ async function processBatchAI( }); // Poll for completion with improved handling - const maxPollingTime = 780000; // 10 minutes + const maxPollingTime = 1200000; // 13 minutes const pollInterval = 5000; // 5 seconds const startTime = Date.now();