From b6b13d4410cb9fe6387bf79ef724144d53811966 Mon Sep 17 00:00:00 2001 From: Eddy de Vink Date: Sun, 11 Oct 2026 19:00:10 +0200 Subject: [PATCH] fix: timeout (30s) op alle bridge-requests; stil hangen werd nooit gerapporteerd (4037/4041-klas see 2026-10-11) --- src/whatsappApi.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/whatsappApi.js b/src/whatsappApi.js index 3001523..16133ed 100644 --- a/src/whatsappApi.js +++ b/src/whatsappApi.js @@ -5,6 +5,11 @@ const API_BASE = process.env.WHATSAPP_API_ENDPOINT const SESSION = process.env.WHATSAPP_SESSION const MAX_RETRIES = 3 const RETRY_DELAY_MS = 1000 +// Zonder timeout hangt een request naar een (tijdelijk) vastgelopen bridge voor +// eeuwig: geen retry, geen fout, geen admin-melding, webhook reageert nooit — +// precies het stille-falen-patroon van 2026-10-11 (dienst 4041). LAN-media-sends +// duren <1s; 30s per poging is ruim. +const REQUEST_TIMEOUT_MS = 30000 // Laat de bridge de juiste mimetype gebruiken bij elke beeld-extensie (png/jpg/jpeg // vooraf ondersteund; onbekende extensies vallen terug op image/png). @@ -49,7 +54,7 @@ async function sendTextMessage(chatId, text) { chatId, contentType: 'string', content: text - }) + }, { timeout: REQUEST_TIMEOUT_MS }) return response.data }, `sendTextMessage to ${chatId}`) } @@ -67,7 +72,7 @@ async function sendImageMessage(chatId, filePath, filename) { data: base64Data, filename: filename } - }) + }, { timeout: REQUEST_TIMEOUT_MS }) return response.data }, `sendImageMessage ${filename} to ${chatId}`) } @@ -95,7 +100,7 @@ async function notifyAdmin(errorText) { async function sendChatSeen(chatId) { const url = `${API_BASE}/client/sendSeen/${SESSION}` - const response = await axios.post(url, { chatId }) + const response = await axios.post(url, { chatId }, { timeout: REQUEST_TIMEOUT_MS }) return response.data }