Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update utils.ts

Kiran K2f4746ac89d4
diff --git a/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/utils.ts b/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/utils.ts
index f1a823058a..d86fc42cd3 100644
--- a/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/utils.ts
+++ b/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/utils.ts
@@ -24,8 +24,7 @@ export async function scheduleDelayedPayouts({
invoice: Pick<Invoice, "id">;
executeAt: Date;
}) {
- // Add 5 minutes to the executeAt time to give some buffer for the card charge to settle fully
- const scheduleTimeMs = executeAt.getTime() + 5 * 60 * 1000;
+ const scheduleTimeMs = executeAt.getTime();
const delaySeconds = Math.max(
0,
@@ -34,7 +33,7 @@ export async function scheduleDelayedPayouts({
const qstashResponse = await qstash.publishJSON({
url: `${APP_DOMAIN_WITH_NGROK}/api/cron/payouts/charge-succeeded`,
- delay: delaySeconds,
+ delay: delaySeconds + 5 * 60, // 5 minutes delay to give some buffer for the card charge to settle fully
deduplicationId: `retry-delayed-payouts-${invoice.id}`, // The deduplication window is 10 minutes
flowControl: {
key: invoice.id,