feat: Allow configuring category sync interval via environment variable and log next sync time.

This commit is contained in:
sebseb7
2025-11-23 10:05:58 +01:00
parent 729d056618
commit 3f451dde06
3 changed files with 17 additions and 15 deletions

View File

@@ -30,21 +30,17 @@ categorySyncer.on('synced', async ({ tree, unprunedTree, changed }) => {
// Trigger immediate sync
categorySyncer.triggerSync();
// Check if running interactively
if (process.stdout.isTTY) {
console.log('🤖 Interactive mode: Syncing every minute. Press Ctrl-C to exit.');
// Schedule periodic sync
const syncInterval = parseInt(process.env.SYNC_INTERVAL_MS) || 60000;
setInterval(() => {
categorySyncer.triggerSync();
}, syncInterval);
// Schedule periodic sync
setInterval(() => {
categorySyncer.triggerSync();
}, 60000);
// Handle graceful shutdown
process.on('SIGINT', () => {
console.log('\n👋 Bye!');
process.exit(0);
});
}
// Handle graceful shutdown
process.on('SIGINT', () => {
console.log('\n👋 Bye!');
process.exit(0);
});
// Start Express server
startServer();