diff --git a/docker-compose.yml b/docker-compose.yml index 605dcf1..c6bd799 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,7 +42,7 @@ services: - TINY_FETCH_SELLER_DETAILS=${TINY_FETCH_SELLER_DETAILS:-false} - TINY_ORDER_DETAILS_CACHE_TTL_MS=${TINY_ORDER_DETAILS_CACHE_TTL_MS:-120000} - TINY_LIVE_REQUEST_DELAY_MS=${TINY_LIVE_REQUEST_DELAY_MS:-6000} - - TINY_LIVE_MAX_QUEUE_WAIT_MS=${TINY_LIVE_MAX_QUEUE_WAIT_MS:-30000} + - TINY_LIVE_MAX_QUEUE_WAIT_MS=${TINY_LIVE_MAX_QUEUE_WAIT_MS:-900000} # Optional: If you use a shared Docker network for Nginx Proxy Manager, you can attach it here: # networks: # - nginx-proxy-manager-network diff --git a/src/controllers/webhook.controller.ts b/src/controllers/webhook.controller.ts index 86cb999..287a8fd 100644 --- a/src/controllers/webhook.controller.ts +++ b/src/controllers/webhook.controller.ts @@ -26,7 +26,10 @@ const numberEnv = (name: string, fallback: number) => { return Number.isFinite(value) && value >= 0 ? value : fallback; }; const LIVE_TINY_REQUEST_DELAY_MS = numberEnv('TINY_LIVE_REQUEST_DELAY_MS', 6000); -const LIVE_TINY_MAX_QUEUE_WAIT_MS = numberEnv('TINY_LIVE_MAX_QUEUE_WAIT_MS', 30000); +// Tiny is acked before the lookup, so queueing costs only latency. Skipping the lookup +// forwards an order with no phone or forma_envio, which n8n can't notify. Keep this a +// last-resort valve (~150 queued webhooks at 6s), not something a burst can hit. +const LIVE_TINY_MAX_QUEUE_WAIT_MS = numberEnv('TINY_LIVE_MAX_QUEUE_WAIT_MS', 900000); let liveTinyQueueTail: Promise = Promise.resolve(); let liveTinyNextRequestAt = 0; let liveTinyPendingRequests = 0;