From 449fdde45af8a2b799805398c0dc7fc9a699c5ac Mon Sep 17 00:00:00 2001 From: arc-alex Date: Fri, 24 Jan 2025 13:24:45 +0100 Subject: [PATCH] fixup! try creating a patch client --- apps/server/src/services/runtime-service/RuntimeService.ts | 7 +++++-- .../src/services/runtime-service/rundownService.utils.ts | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/server/src/services/runtime-service/RuntimeService.ts b/apps/server/src/services/runtime-service/RuntimeService.ts index b099822e17..bb812f3122 100644 --- a/apps/server/src/services/runtime-service/RuntimeService.ts +++ b/apps/server/src/services/runtime-service/RuntimeService.ts @@ -678,8 +678,11 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert // we do the comparison by explicitly for each property // to apply custom logic for different datasets - const shouldForceTimerUpdate = - state.timer.playback === Playback.Play && getForceUpdate(RuntimeService.previousTimerUpdate, state.clock); + const shouldForceTimerUpdate = getForceUpdate( + RuntimeService.previousTimerUpdate, + state.clock, + state.timer.playback, + ); const shouldUpdateTimer = shouldForceTimerUpdate || getShouldTimerUpdate(RuntimeService.previousTimerValue, state.timer.current); diff --git a/apps/server/src/services/runtime-service/rundownService.utils.ts b/apps/server/src/services/runtime-service/rundownService.utils.ts index 9e2e5b1f4e..ca0b851aca 100644 --- a/apps/server/src/services/runtime-service/rundownService.utils.ts +++ b/apps/server/src/services/runtime-service/rundownService.utils.ts @@ -1,7 +1,7 @@ import { millisToSeconds } from 'ontime-utils'; import { timerConfig } from '../../config/config.js'; -import { MaybeNumber } from 'ontime-types'; +import { MaybeNumber, Playback } from 'ontime-types'; /** * Checks whether we should update the clock value @@ -34,8 +34,10 @@ export function getShouldTimerUpdate(previousValue: number, currentValue: MaybeN * In some cases we want to force an update to the timer * - if the clock has slid back * - if we have escaped the update rate (clock slid forward) + * - if we are not playing then there is no need to update the timer */ -export function getForceUpdate(previousUpdate: number, now: number): boolean { +export function getForceUpdate(previousUpdate: number, now: number, playbackState: Playback = Playback.Play): boolean { + if (playbackState !== Playback.Play) return false; const isClockBehind = now < previousUpdate; const hasExceededRate = now - previousUpdate >= timerConfig.notificationRate; return isClockBehind || hasExceededRate;