@@ -1320,10 +1320,10 @@ export namespace Webhook {
13201320 } ;
13211321 }
13221322
1323- export async function findWebhookAttempt ( projectId : string , endpointId : string , svixToken : string , fn : ( msg : any ) => boolean ) {
1323+ export async function findWebhookAttempt ( projectId : string , endpointId : string , svixToken : string , fn : ( msg : any ) => boolean , retryCount : number = 5 ) {
13241324 // retry many times because Svix sucks and is slow
1325- for ( let i = 0 ; i < 20 ; i ++ ) {
1326- const attempts = await Webhook . listWebhookAttempts ( projectId , endpointId , svixToken , 1 ) ;
1325+ for ( let i = 0 ; i < retryCount ; i ++ ) {
1326+ const attempts = await Webhook . listWebhookAttempts ( projectId , endpointId , svixToken ) ;
13271327 const filtered = attempts . filter ( fn ) ;
13281328 if ( filtered . length === 0 ) {
13291329 await wait ( 500 ) ;
@@ -1337,7 +1337,7 @@ export namespace Webhook {
13371337 throw new Error ( `Webhook attempt not found for project ${ projectId } , endpoint ${ endpointId } ` ) ;
13381338 }
13391339
1340- export async function listWebhookAttempts ( projectId : string , endpointId : string , svixToken : string , retryCount : number = 20 ) {
1340+ export async function listWebhookAttempts ( projectId : string , endpointId : string , svixToken : string , retryCount : number = 5 ) {
13411341 // retry many times because Svix sucks and is slow
13421342 for ( let i = 0 ; i < retryCount ; i ++ ) {
13431343 const response = await niceFetch ( STACK_SVIX_SERVER_URL + `/api/v1/app/${ projectId } /attempt/endpoint/${ endpointId } ` , {
0 commit comments