fix(webhooks): long-process webhooks

This commit is contained in:
Emir Karabeg
2025-04-15 13:46:09 -07:00
parent fd3ee35610
commit 4d6a4566b7
@@ -314,6 +314,13 @@ export async function POST(
}
})();
// Store reference to processing task to prevent garbage collection
const taskId = `${requestId}:${Date.now()}`;
activeProcessingTasks.set(taskId, processingPromise.finally(() => {
logger.info(`[${requestId}] Processing complete, removing from active tasks`);
activeProcessingTasks.delete(taskId);
}));
// Race processing against timeout to ensure fast response
return Promise.race([timeoutPromise, processingPromise]);
}