import type { Worker } from 'node:cluster'
-import type { MessagePort } from 'node:worker_threads'
import { performance } from 'node:perf_hooks'
+import type { MessagePort } from 'node:worker_threads'
+
import type {
MessageValue,
Task,
isAsyncFunction,
isPlainObject
} from '../utils.js'
-import { KillBehaviors, type WorkerOptions } from './worker-options.js'
import type {
TaskAsyncFunction,
TaskFunction,
checkValidTaskFunctionEntry,
checkValidWorkerOptions
} from './utils.js'
+import { KillBehaviors, type WorkerOptions } from './worker-options.js'
const DEFAULT_MAX_INACTIVE_TIME = 60000
const DEFAULT_WORKER_OPTIONS: WorkerOptions = {
this.taskFunctions.set(DEFAULT_TASK_NAME, boundFn)
this.taskFunctions.set(
typeof taskFunctions.name === 'string' &&
- taskFunctions.name.trim().length > 0
+ taskFunctions.name.trim().length > 0
? taskFunctions.name
: 'fn1',
boundFn