From e6dfe9c3635b4b16a6620091b6283458946641cf Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Wed, 18 Dec 2024 23:51:51 +0100 Subject: [PATCH] fix: rolling over midnight wrongly classified as skip --- apps/server/src/config/config.ts | 2 +- apps/server/src/services/runtime-service/RuntimeService.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/server/src/config/config.ts b/apps/server/src/config/config.ts index 67af650e8..80778d468 100644 --- a/apps/server/src/config/config.ts +++ b/apps/server/src/config/config.ts @@ -1,7 +1,7 @@ import { MILLIS_PER_MINUTE } from 'ontime-utils'; export const timerConfig = { - skipLimit: 1000, // threshold of skip for recalculating + skipLimit: 1000, // threshold of skip for recalculating, values lower than updateRate can cause issues with rolling over midnight updateRate: 32, // how often do we update the timer notificationRate: 1000, // how often do we notify clients and integrations triggerAhead: 10, // how far ahead do we trigger the end event diff --git a/apps/server/src/services/runtime-service/RuntimeService.ts b/apps/server/src/services/runtime-service/RuntimeService.ts index 43c50e888..1d8be1d4f 100644 --- a/apps/server/src/services/runtime-service/RuntimeService.ts +++ b/apps/server/src/services/runtime-service/RuntimeService.ts @@ -99,10 +99,15 @@ class RuntimeService { }); this.handleLoadNext(); this.rollLoaded(keepOffset); - } else if (skippedOutOfEvent(newState, this.lastIntegrationClockUpdate, timerConfig.skipLimit)) { + } else if ( + // if there is no previous clock, we could not have skipped + RuntimeService.previousState?.clock && + skippedOutOfEvent(newState, RuntimeService.previousState.clock, timerConfig.skipLimit) + ) { // if we have skipped out of the event, we will recall roll // to push the playback to the right place // this comes with the caveat that we will lose our runtime data + logger.warning(LogOrigin.Playback, 'Time skip detected, reloading roll'); this.roll(true); } }