From 26872e2bac0fe3b5ee1d0088392b67b0330911e7 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Tue, 30 Jan 2024 09:36:25 +0100 Subject: [PATCH] :bug: Add max wait block timeout on WhatsApp runtime --- packages/bot-engine/whatsapp/sendChatReplyToWhatsApp.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/bot-engine/whatsapp/sendChatReplyToWhatsApp.ts b/packages/bot-engine/whatsapp/sendChatReplyToWhatsApp.ts index 4193e850c..c4aca5657 100644 --- a/packages/bot-engine/whatsapp/sendChatReplyToWhatsApp.ts +++ b/packages/bot-engine/whatsapp/sendChatReplyToWhatsApp.ts @@ -217,7 +217,10 @@ const executeClientSideAction = ): Promise<{ replyToSend: string | undefined } | void> => { if ('wait' in clientSideAction) { await new Promise((resolve) => - setTimeout(resolve, clientSideAction.wait.secondsToWaitFor * 1000) + setTimeout( + resolve, + Math.min(clientSideAction.wait.secondsToWaitFor, 10) * 1000 + ) ) if (!clientSideAction.expectsDedicatedReply) return return {