From 2c5cb6abe4ad870b6d0122b7768f759d57771a8d Mon Sep 17 00:00:00 2001 From: DexterStorey <36115192+DexterStorey@users.noreply.github.com> Date: Thu, 12 Oct 2023 08:55:42 -0400 Subject: [PATCH] fix: reduce no-response errors in cal ai with increase of timeout threshold (#11845) * increase agent loop timeout threshold * increase api/receive timeout threshold --- apps/ai/src/app/api/agent/route.ts | 3 +++ apps/ai/src/app/api/receive/route.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/apps/ai/src/app/api/agent/route.ts b/apps/ai/src/app/api/agent/route.ts index b707c9d56d..e39f7329a5 100644 --- a/apps/ai/src/app/api/agent/route.ts +++ b/apps/ai/src/app/api/agent/route.ts @@ -5,6 +5,9 @@ import agent from "../../../utils/agent"; import sendEmail from "../../../utils/sendEmail"; import { verifyParseKey } from "../../../utils/verifyParseKey"; +// Allow agent loop to run for up to 5 minutes +export const maxDuration = 300; + /** * Launches a LangChain agent to process an incoming email, * then sends the response to the user. diff --git a/apps/ai/src/app/api/receive/route.ts b/apps/ai/src/app/api/receive/route.ts index 1697bdd4a5..a988beb51b 100644 --- a/apps/ai/src/app/api/receive/route.ts +++ b/apps/ai/src/app/api/receive/route.ts @@ -14,6 +14,10 @@ import now from "../../../utils/now"; import sendEmail from "../../../utils/sendEmail"; import { verifyParseKey } from "../../../utils/verifyParseKey"; +// Allow receive loop to run for up to 30 seconds +// Why so long? the rate determining API call (getAvailability, getEventTypes) can take up to 15 seconds at peak times so we give it a little extra time to complete. +export const maxDuration = 30; + /** * Verifies email signature and app authorization, * then hands off to booking agent.