mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-26 14:28:30 +00:00
fix: timeout in space assignment and return response in add
This commit is contained in:
parent
084ad5be85
commit
de94f67f7b
@ -14,8 +14,8 @@ const { action, loader } = createHybridActionApiRoute(
|
|||||||
corsStrategy: "all",
|
corsStrategy: "all",
|
||||||
},
|
},
|
||||||
async ({ body, authentication }) => {
|
async ({ body, authentication }) => {
|
||||||
const response = addToQueue(body, authentication.userId);
|
const response = await addToQueue(body, authentication.userId);
|
||||||
return json({ ...response });
|
return json({ success: true, id: response.id });
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -174,7 +174,7 @@ async function checkAndTriggerSpacePatterns(
|
|||||||
|
|
||||||
export const spaceAssignmentTask = task({
|
export const spaceAssignmentTask = task({
|
||||||
id: "space-assignment",
|
id: "space-assignment",
|
||||||
maxDuration: 900, // 15 minutes timeout
|
maxDuration: 1800, // 15 minutes timeout
|
||||||
run: async (payload: SpaceAssignmentPayload) => {
|
run: async (payload: SpaceAssignmentPayload) => {
|
||||||
const {
|
const {
|
||||||
userId,
|
userId,
|
||||||
@ -550,7 +550,7 @@ async function processBatchAI(
|
|||||||
requests: batchRequests,
|
requests: batchRequests,
|
||||||
outputSchema: AssignmentResultSchema,
|
outputSchema: AssignmentResultSchema,
|
||||||
maxRetries: 3,
|
maxRetries: 3,
|
||||||
timeoutMs: 600000, // 10 minutes timeout
|
timeoutMs: 1200000, // 10 minutes timeout
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info(`Batch AI job created: ${batchId}`, {
|
logger.info(`Batch AI job created: ${batchId}`, {
|
||||||
@ -560,7 +560,7 @@ async function processBatchAI(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Poll for completion with improved handling
|
// Poll for completion with improved handling
|
||||||
const maxPollingTime = 780000; // 10 minutes
|
const maxPollingTime = 1200000; // 13 minutes
|
||||||
const pollInterval = 5000; // 5 seconds
|
const pollInterval = 5000; // 5 seconds
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user