From fc7850487c30e3c1ba45cce9b9262ba520238319 Mon Sep 17 00:00:00 2001 From: Zai Shi Date: Tue, 22 Jul 2025 15:40:42 -0700 Subject: [PATCH] maximum of 5 retries for webhooks --- apps/e2e/tests/backend/backend-helpers.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/e2e/tests/backend/backend-helpers.ts b/apps/e2e/tests/backend/backend-helpers.ts index 576131d95..d89bb8cbd 100644 --- a/apps/e2e/tests/backend/backend-helpers.ts +++ b/apps/e2e/tests/backend/backend-helpers.ts @@ -1320,10 +1320,10 @@ export namespace Webhook { }; } - export async function findWebhookAttempt(projectId: string, endpointId: string, svixToken: string, fn: (msg: any) => boolean) { + export async function findWebhookAttempt(projectId: string, endpointId: string, svixToken: string, fn: (msg: any) => boolean, retryCount: number = 5) { // retry many times because Svix sucks and is slow - for (let i = 0; i < 20; i++) { - const attempts = await Webhook.listWebhookAttempts(projectId, endpointId, svixToken, 1); + for (let i = 0; i < retryCount; i++) { + const attempts = await Webhook.listWebhookAttempts(projectId, endpointId, svixToken); const filtered = attempts.filter(fn); if (filtered.length === 0) { await wait(500); @@ -1337,7 +1337,7 @@ export namespace Webhook { throw new Error(`Webhook attempt not found for project ${projectId}, endpoint ${endpointId}`); } - export async function listWebhookAttempts(projectId: string, endpointId: string, svixToken: string, retryCount: number = 20) { + export async function listWebhookAttempts(projectId: string, endpointId: string, svixToken: string, retryCount: number = 5) { // retry many times because Svix sucks and is slow for (let i = 0; i < retryCount; i++) { const response = await niceFetch(STACK_SVIX_SERVER_URL + `/api/v1/app/${projectId}/attempt/endpoint/${endpointId}`, {