jiraCloud/jobs/cron.js
jmcqueen 0b056739e9 Add modular Jira-to-Webex approvals service with Docker deployment.
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>
2026-07-17 08:34:47 -04:00

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);
}
});
});
}