Skip to content

Commit e6449a2

Browse files
committed
fix(emails): Update default abandoned cart emails cron and handle up to 200 carts each exec
1 parent 07f3bf2 commit e6449a2

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/apps/emails/src/cron-cart-emails.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const sendCartEmails = async () => {
2626
},
2727
fields: ['_id', 'flags', 'completed', 'customers'] as const,
2828
sort: ['-updated_at'],
29-
limit: 100,
29+
limit: 200,
3030
});
3131
if (!abandonedCarts.length) {
3232
return;

packages/apps/emails/src/transactional-emails.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ const { httpsFunctionOptions: { region } } = config.get();
1212
export const emails = {
1313
onStoreEvent: createAppEventsFunction('emails', handleApiEvent),
1414

15-
cronAbandonedCarts: functions.region(region).pubsub
16-
.schedule(process.env.CRONTAB_EMAILS_ABANDONED_CARTS || '25 */3 * * *')
15+
cronAbandonedCarts: functions.region(region)
16+
.runWith({ timeoutSeconds: 300 })
17+
.pubsub
18+
.schedule(process.env.CRONTAB_EMAILS_ABANDONED_CARTS || '25 12,15,19 * * *')
1719
.onRun(() => {
1820
return sendCartEmails();
1921
}),
2022

21-
cronExpiringPoints: functions.region(region).pubsub
23+
cronExpiringPoints: functions.region(region)
24+
.pubsub
2225
.schedule(process.env.CRONTAB_EMAILS_EXPIRING_POINTS || '37 14 * * 1,4')
2326
.onRun(() => {
2427
return sendPointsEmails();

0 commit comments

Comments
 (0)