This commit is contained in:
2025-06-10 14:05:09 +02:00
parent 218705da52
commit bd07939c3d
3 changed files with 22 additions and 10 deletions

View File

@@ -2,18 +2,28 @@ import { scheduleEOIReminders } from '~/server/tasks/eoi-reminders';
import { scheduleEmailProcessing } from '~/server/tasks/process-sales-emails';
export default defineNitroPlugin((nitroApp) => {
console.log('[Plugin] Initializing automated tasks...');
// Schedule EOI reminders when server starts
console.log('[Plugin] Initializing EOI reminder scheduler...');
// Add a small delay to ensure all services are ready
setTimeout(() => {
scheduleEOIReminders();
setTimeout(async () => {
try {
await scheduleEOIReminders();
} catch (error) {
console.error('[Plugin] Failed to schedule EOI reminders:', error);
}
}, 5000);
// Schedule email processing for EOI attachments
console.log('[Plugin] Initializing email processing scheduler...');
setTimeout(() => {
scheduleEmailProcessing();
setTimeout(async () => {
try {
await scheduleEmailProcessing();
} catch (error) {
console.error('[Plugin] Failed to schedule email processing:', error);
}
}, 7000);
});