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