Added missing weight emails
Deploy / deploy-dev (push) Successful in 2m15s
Deploy / deploy-prod (push) Skipped

This commit is contained in:
blaisadmin
2026-09-05 22:51:39 -04:00
parent b4254a68fa
commit 5abc7f6174
13 changed files with 501 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
import { Queue } from 'bullmq';
import { redisConnection } from './redisConnection.js';
export const weightReminderQueueName = 'weight-reminders';
export const weightReminderQueue = new Queue(weightReminderQueueName, {
connection: redisConnection,
defaultJobOptions: {
attempts: 3,
backoff: { type: 'exponential', delay: 60_000 },
removeOnComplete: 100,
removeOnFail: 1000,
},
});
export const startWeightReminderScheduler = async () => {
if (process.env.WEIGHT_REMINDERS_ENABLED === 'false') {
await weightReminderQueue.removeJobScheduler('weight-reminders');
return;
}
await weightReminderQueue.setGlobalConcurrency(1);
await weightReminderQueue.upsertJobScheduler(
'weight-reminders',
{ every: 5 * 60_000 },
{ name: 'check-overdue-weights', data: {} },
);
};