in middleware/cron/syncTransactionHistory.js [247:271]
async function initSyncService(options = {}) {
const { scheduleJob = true, cronSchedule = '0 * * * *' } = options;
try {
// Initialize database
await initializeDatabase();
// Run initial sync
await syncTransactionHistory();
// Schedule recurring job if requested
if (scheduleJob) {
cron.schedule(cronSchedule, async () => {
logger.info(`Running scheduled transaction history sync (${cronSchedule})`);
await syncTransactionHistory();
});
logger.info(`Transaction history sync service initialized and scheduled (${cronSchedule})`);
} else {
logger.info('Transaction history sync completed (one-time run)');
}
} catch (error) {
logger.error('Failed to initialize transaction history sync service:', error);
}
}