super(type)
this.checkWorkerOptions(this.opts)
this.checkTaskFunctions(taskFunctions)
- if (!this.isMain) {
+ if (
+ !this.isMain &&
+ (this.opts.maxInactiveTime ?? DEFAULT_MAX_INACTIVE_TIME) > 0
+ ) {
this.lastTaskTimestamp = performance.now()
this.aliveInterval = setInterval(
this.checkAlive.bind(this),
name = name ?? DEFAULT_FUNCTION_NAME
const fn = this.taskFunctions.get(name)
if (fn == null) {
- throw new Error(`Task function "${name}" not found`)
+ throw new Error(`Task function '${name}' not found`)
}
return fn
}