1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-08 15:05:22 +02:00

Remove scheduled trail-reminder email when STRIPE_API_KEY is set

This commit is contained in:
Simon Bukin 2024-01-18 16:22:00 -08:00
parent e1f8de527a
commit 83f50a59dc
2 changed files with 9 additions and 5 deletions

View file

@ -33,6 +33,8 @@ const envSchema = z.object({
NX_CDN_PRIVATE_BUCKET: z.string().default('REPLACE_THIS'),
NX_CDN_PUBLIC_BUCKET: z.string().default('REPLACE_THIS'),
STRIPE_API_KEY: z.string().optional(),
})
const env = envSchema.parse(process.env)

View file

@ -154,11 +154,13 @@ syncInstitutionQueue.add(
*/
sendEmailQueue.process('send-email', async (job) => await emailProcessor.send(job.data))
sendEmailQueue.add(
'send-email',
{ type: 'trial-reminders' },
{ repeat: { cron: '0 */12 * * *' } } // Run every 12 hours
)
if (env.STRIPE_API_KEY) {
sendEmailQueue.add(
'send-email',
{ type: 'trial-reminders' },
{ repeat: { cron: '0 */12 * * *' } } // Run every 12 hours
)
}
// Fallback - usually triggered by errors not handled (or thrown) within the Bull event handlers (see above)
process.on(