Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(api): increase retry count and delay for stripe user lookup

Richie McIlroyd505f691cfe7
diff --git a/apps/web/app/api/webhooks/stripe/route.ts b/apps/web/app/api/webhooks/stripe/route.ts
index a284229c4..adb2a8cc2 100644
--- a/apps/web/app/api/webhooks/stripe/route.ts
+++ b/apps/web/app/api/webhooks/stripe/route.ts
@@ -49,7 +49,7 @@ async function createGuestUser(
async function findUserWithRetry(
email: string,
userId?: User.UserId,
- maxRetries = 2,
+ maxRetries = 3,
): Promise<typeof users.$inferSelect | null> {
for (let i = 0; i < maxRetries; i++) {
console.log(`[Attempt ${i + 1}/${maxRetries}] Looking for user:`, {
@@ -91,7 +91,7 @@ async function findUserWithRetry(
}
if (i < maxRetries - 1) {
- const delay = 2 ** i * 500;
+ const delay = 2 ** i * 1000;
console.log(
`No user found on attempt ${
i + 1
@@ -102,7 +102,7 @@ async function findUserWithRetry(
} catch (error) {
console.error(`Error during attempt ${i + 1}:`, error);
if (i < maxRetries - 1) {
- const delay = 2 ** i * 500;
+ const delay = 2 ** i * 1000;
await new Promise((resolve) => setTimeout(resolve, delay));
}
}