Updated sync timer logging
This commit is contained in:
@@ -40,19 +40,25 @@ class SyncService {
|
|||||||
|
|
||||||
const intervalMs = intervalHours * 60 * 60 * 1000;
|
const intervalMs = intervalHours * 60 * 60 * 1000;
|
||||||
|
|
||||||
// Don't restart if interval hasn't changed
|
// Don't restart if interval hasn't changed and timer exists
|
||||||
if (this._currentInterval === intervalHours && this._syncTimer) {
|
if (this._currentInterval === intervalHours && this._syncTimer) {
|
||||||
|
console.log(`[Sync] Timer already running for ${intervalHours} hours, not restarting`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear existing timer
|
// Clear existing timer
|
||||||
this.stopSyncTimer();
|
this.stopSyncTimer();
|
||||||
|
|
||||||
|
const nextSyncTime = new Date(Date.now() + intervalMs);
|
||||||
console.log(`[Sync] Starting server-side sync timer: every ${intervalHours} hours`);
|
console.log(`[Sync] Starting server-side sync timer: every ${intervalHours} hours`);
|
||||||
|
console.log(`[Sync] Next scheduled sync at: ${nextSyncTime.toLocaleString()}`);
|
||||||
|
|
||||||
this._syncTimer = setInterval(async () => {
|
this._syncTimer = setInterval(async () => {
|
||||||
console.log('[Sync] Scheduled sync triggered');
|
console.log('[Sync] Scheduled sync triggered');
|
||||||
await this.syncAll();
|
await this.syncAll();
|
||||||
|
// Log next sync time
|
||||||
|
const next = new Date(Date.now() + intervalMs);
|
||||||
|
console.log(`[Sync] Next scheduled sync at: ${next.toLocaleString()}`);
|
||||||
}, intervalMs);
|
}, intervalMs);
|
||||||
|
|
||||||
this._currentInterval = intervalHours;
|
this._currentInterval = intervalHours;
|
||||||
|
|||||||
Reference in New Issue
Block a user