## [Unreleased]
+### Fixed
+
+- Recreate the right worker type on uncaught exception.
+
+### Added
+
+- Add minimum and maximum to internal measurement statistics.
+
## [2.6.8] - 2023-07-03
### Fixed
-import crypto from 'node:crypto'
+import { randomUUID } from 'node:crypto'
import { performance } from 'node:perf_hooks'
import type { MessageValue, PromiseResponseWrapper } from '../utility-types'
import {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
data: data ?? ({} as Data),
timestamp,
- id: crypto.randomUUID()
+ id: randomUUID()
}
const res = new Promise<Response>((resolve, reject) => {
this.promiseResponseMap.set(submittedTask.id as string, {
private checkAndEmitEvents (): void {
if (this.emitter != null) {
if (this.busy) {
- this.emitter?.emit(PoolEvents.busy, this.info)
+ this.emitter.emit(PoolEvents.busy, this.info)
}
if (this.type === PoolTypes.dynamic && this.full) {
- this.emitter?.emit(PoolEvents.full, this.info)
+ this.emitter.emit(PoolEvents.full, this.info)
}
}
}
-import EventEmitterAsyncResource from 'node:events'
+import { EventEmitter } from 'node:events'
import type {
ErrorHandler,
ExitHandler,
/**
* Pool events emitter.
*/
-export class PoolEmitter extends EventEmitterAsyncResource {}
+export class PoolEmitter extends EventEmitter {}
/**
* Enumeration of pool events.
* Started flag.
*/
started: boolean
- /**
- * Shared buffer.
- */
- readonly sharedBuffer?: Int32Array
}
/**
-import os from 'node:os'
+import { cpus, availableParallelism as parallelism } from 'node:os'
import type {
MeasurementStatisticsRequirements,
WorkerChoiceStrategyOptions
export const availableParallelism = (): number => {
let availableParallelism = 1
try {
- availableParallelism = os.availableParallelism()
+ availableParallelism = parallelism()
} catch {
- const cpus = os.cpus()
- if (Array.isArray(cpus) && cpus.length > 0) {
- availableParallelism = cpus.length
+ const numberOfCpus = cpus()
+ if (Array.isArray(numberOfCpus) && numberOfCpus.length > 0) {
+ availableParallelism = numberOfCpus.length
}
}
return availableParallelism
"module": "ES2022",
"outDir": "lib",
"moduleResolution": "Node",
- "esModuleInterop": true,
"declaration": true,
"strict": true,
"forceConsistentCasingInFileNames": true