Skip to content

Commit

Permalink
fix: SOF-1091 increase threadedClass freezeLimit
Browse files Browse the repository at this point in the history
unless we have some endless loops etc., it is safe to assume the child
thread can be busy fore more than a second due to varius reasons
  • Loading branch information
ianshade committed Aug 24, 2022
1 parent bcef40a commit f852b99
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/timeline-state-resolver/src/conductor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { TCPSendDevice, DeviceOptionsTCPSendInternal } from './devices/tcpSend'
import { PharosDevice, DeviceOptionsPharosInternal } from './devices/pharos'
import { OSCMessageDevice, DeviceOptionsOSCInternal } from './devices/osc'
import { DeviceContainer } from './devices/deviceContainer'
import { MemUsageReport, threadedClass, ThreadedClass, ThreadedClassManager } from 'threadedclass'
import { MemUsageReport, threadedClass, ThreadedClass, ThreadedClassConfig, ThreadedClassManager } from 'threadedclass'
import { AsyncResolver } from './AsyncResolver'
import { HTTPWatcherDevice, DeviceOptionsHTTPWatcherInternal } from './devices/httpWatcher'
import { QuantelDevice, DeviceOptionsQuantelInternal } from './devices/quantel'
Expand All @@ -56,6 +56,8 @@ export const MINTIMEUNIT = 1 // Minimum unit of time
/** When resolving and the timeline has repeating objects, only resolve this far into the future */
const RESOLVE_LIMIT_TIME = 10000

const FREEZE_LIMIT = 5000 // how long to wait before considering the child to be unresponsive

export type TimelineTriggerTimeResult = Array<{ id: string; time: number }>

export { Device } from './devices/device'
Expand Down Expand Up @@ -384,11 +386,12 @@ export class Conductor extends EventEmitter<ConductorEvents> {
throw new Error(`Device "${deviceId}" already exists when creating device`)
}

const threadedClassOptions = {
const threadedClassOptions: ThreadedClassConfig = {
threadUsage: deviceOptions.threadUsage || 1,
autoRestart: false,
disableMultithreading: !deviceOptions.isMultiThreaded,
instanceName: deviceId,
freezeLimit: FREEZE_LIMIT,
}

const getCurrentTime = () => {
Expand All @@ -403,10 +406,8 @@ export class Conductor extends EventEmitter<ConductorEvents> {
deviceOptions,
getCurrentTime,
{
...threadedClassOptions,
threadUsage: deviceOptions.isMultiThreaded ? 0.1 : 0,
autoRestart: false,
disableMultithreading: !deviceOptions.isMultiThreaded,
instanceName: deviceId,
}
)
} else if (deviceOptions.type === DeviceType.CASPARCG) {
Expand Down

0 comments on commit f852b99

Please sign in to comment.