Stabilize logging, correlation IDs, service-account Jira auth, and direct approver reminder DMs while splitting the monolith into focused modules with Compose-based deployment. Co-authored-by: Cursor <cursoragent@cursor.com>
18 lines
746 B
JavaScript
18 lines
746 B
JavaScript
import cron from 'node-cron';
|
|
import { createCorrelationId, runWithCorrelationId } from '../lib/correlation.js';
|
|
|
|
export function scheduleJobs({ runPendingApprovals, cleanupOldLogs, log }) {
|
|
cron.schedule('0 30 9 * * *', async function () {
|
|
const correlationId = createCorrelationId({ routeName: 'cron' });
|
|
await runWithCorrelationId(correlationId, async () => {
|
|
try {
|
|
log.logger('cron', 'Starting scheduled job');
|
|
await runPendingApprovals();
|
|
await cleanupOldLogs();
|
|
log.logger('cron', 'Scheduled job completed');
|
|
} catch (error) {
|
|
log.logError('cron', 'Scheduled job failed', error);
|
|
}
|
|
});
|
|
});
|
|
}
|