mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-08 17:03:53 +00:00
tweek update rate
This commit is contained in:
@@ -716,6 +716,9 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
|
||||
// combine all big changes
|
||||
const hasImmediateChanges = hasNewLoaded || justStarted || hasChangedPlayback || offsetModeChanged;
|
||||
|
||||
// we would like the wall clock to tick on a regular rate
|
||||
const beutyClockUpdate = getShouldClockUpdate(RuntimeService.previousClockUpdate, state.clock);
|
||||
|
||||
/**
|
||||
* Timer should be updated if
|
||||
* - big changes
|
||||
@@ -732,6 +735,7 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
|
||||
|
||||
/**
|
||||
* Runtime should be updated if
|
||||
* - clock tick
|
||||
* - big changes
|
||||
* - the timer is updating so runtime also updates to keep them in sync ???
|
||||
* - notification rate has been exceeded
|
||||
@@ -739,7 +743,10 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
|
||||
* Then check if there is actually a change in the data
|
||||
*/
|
||||
const shouldRuntimeUpdate =
|
||||
(hasImmediateChanges || shouldUpdateTimer || getForceUpdate(RuntimeService.previousRuntimeUpdate, state.clock)) &&
|
||||
(beutyClockUpdate ||
|
||||
hasImmediateChanges ||
|
||||
shouldUpdateTimer ||
|
||||
getForceUpdate(RuntimeService.previousRuntimeUpdate, state.clock)) &&
|
||||
!deepEqual(RuntimeService.previousState?.runtime, state.runtime);
|
||||
|
||||
/**
|
||||
@@ -750,13 +757,9 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
|
||||
/**
|
||||
* Many other values are calculated based on the clock
|
||||
* so if any of them are updated we also need to send the clock
|
||||
* in case nothing else is updating the clock will bw updated at the notification rate
|
||||
* in case nothing else is updating the clock will be updated at the notification rate
|
||||
*/
|
||||
const shouldUpdateClock =
|
||||
shouldUpdateTimer ||
|
||||
shouldRuntimeUpdate ||
|
||||
shouldBlockUpdate ||
|
||||
getForceUpdate(RuntimeService.previousClockUpdate, state.clock);
|
||||
const shouldUpdateClock = shouldRuntimeUpdate || shouldBlockUpdate || beutyClockUpdate;
|
||||
|
||||
//Now we set all the updates on the eventstore and update the previous value
|
||||
if (hasChangedPlayback) {
|
||||
|
||||
@@ -9,10 +9,6 @@ import { timerConfig } from '../../setup/config.js';
|
||||
* - we have rolled into a new seconds unit
|
||||
*/
|
||||
export function getShouldClockUpdate(previousUpdate: number, now: number): boolean {
|
||||
const shouldForceUpdate = getForceUpdate(previousUpdate, now);
|
||||
if (shouldForceUpdate) {
|
||||
return true;
|
||||
}
|
||||
const newSeconds = millisToSeconds(now, TimerType.CountUp) !== millisToSeconds(previousUpdate, TimerType.CountUp);
|
||||
return newSeconds;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user