- * @param fn - Function that will be executed.
- * @param message - Input data for the given function.
+ * @param task - The task to execute.
+ * @throws {@link https://nodejs.org/api/errors.html#class-error} If the task function is not found.
+ */
+ protected run (task: Task<Data>): void {
+ const fn = this.getTaskFunction(task.name)
+ if (isAsyncFunction(fn)) {
+ this.runInAsyncScope(this.runAsync.bind(this), this, fn, task)
+ } else {
+ this.runInAsyncScope(this.runSync.bind(this), this, fn, task)
+ }
+ }
+
+ /**
+ * Runs the given task function synchronously.
+ *
+ * @param fn - Task function that will be executed.
+ * @param task - Input data for the task function.