* The start timestamp of the pool.
*/
private readonly startTimestamp
+ /**
+ * The task function names.
+ */
+ private taskFunctions!: string[]
/**
* Constructs a new poolifier pool.
}
}
+ /** @inheritDoc */
+ public listTaskFunctions (): string[] {
+ if (this.taskFunctions != null) {
+ return this.taskFunctions
+ } else {
+ return []
+ }
+ }
+
/** @inheritDoc */
public async execute (
data?: Data,
if (name != null && typeof name !== 'string') {
reject(new TypeError('name argument must be a string'))
}
+ if (
+ name != null &&
+ typeof name === 'string' &&
+ name.trim().length === 0
+ ) {
+ reject(new Error('name argument must not be an empty string'))
+ }
+ if (name != null && !this.taskFunctions.includes(name)) {
+ reject(
+ new Error(`Task function '${name}' is not registered in the pool`)
+ )
+ }
if (transferList != null && !Array.isArray(transferList)) {
reject(new TypeError('transferList argument must be an array'))
}
} else if (message.taskId != null) {
// Task execution response received from worker
this.handleTaskExecutionResponse(message)
+ } else if (message.taskFunctions != null) {
+ // Task functions message received from worker
+ this.taskFunctions = message.taskFunctions
}
}
}