diff --git a/docs/docs/api-reference/class.md b/docs/docs/api-reference/class.md index e2599fbe..e53318ce 100644 --- a/docs/docs/api-reference/class.md +++ b/docs/docs/api-reference/class.md @@ -101,6 +101,9 @@ This class extends [`EventEmitter`](https://nodejs.org/api/events.html) from Nod - `workerHistogram`: (`boolean`) By default `false`. It will hint the Worker pool to record statistics for each individual Worker - `loadBalancer`: ([`PiscinaLoadBalancer`](#piscinaloadbalancer)) By default, Piscina uses a least-busy algorithm. The `loadBalancer` option can be used to provide an alternative implementation. See [Custom Load Balancers](../advanced-topics/loadbalancer.mdx) for additional detail. + - `workerHistogram`: (`boolean`) By default `false`. It will hint the Worker pool to record statistics for each individual Worker + - `loadBalancer`: ([`PiscinaLoadBalancer`](#piscinaloadbalancer)) By default, Piscina uses a least-busy algorithm. The `loadBalancer` + option can be used to provide an alternative implementation. See [Custom Load Balancers](../advanced-topics/loadbalancer.mdx) for additional detail. :::caution Use caution when setting resource limits. Setting limits that are too low may @@ -152,7 +155,6 @@ interface PiscinaWorker { ### Example: Custom Load Balancer #### JavaScript - ```js @@ -193,7 +195,6 @@ piscina ``` #### TypeScript - ```ts diff --git a/docs/package-lock.json b/docs/package-lock.json index b0c5a742..f08b308d 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -5308,9 +5308,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/package-lock.json b/package-lock.json index 9d574861..8f7d5942 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "tap": "^16.3.7", "tinybench": "^3.0.0", "ts-node": "^10.9.2", - "typescript": "5.6.3" + "typescript": "5.7.2" }, "engines": { "node": ">=18.x" @@ -1168,13 +1168,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.8.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.1.tgz", - "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", + "version": "22.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.1.tgz", + "integrity": "sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~6.19.8" + "undici-types": "~6.20.0" } }, "node_modules/@types/semver": { @@ -8978,9 +8978,9 @@ "license": "MIT" }, "node_modules/tinybench": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-3.0.0.tgz", - "integrity": "sha512-931sGm66Zjp7c4o/DePaq8AKlCdq/ZldpS1b8O7r3SxSuxJpqoqeUprTOsW2CBhrw54U3mTmcS97LsBqPXEQLw==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-3.0.6.tgz", + "integrity": "sha512-ljQ0LM7ePiVrjM8KHkHUWH+eVo36hwpE34dqYvOJIvzVJvzqXwTpjjw/bLjduqU50Z8CuhVFgFN1U7yLaSCsCg==", "dev": true, "engines": { "node": ">=18.0.0" @@ -9220,9 +9220,9 @@ } }, "node_modules/typescript": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", - "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -9249,11 +9249,10 @@ } }, "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true, - "license": "MIT" + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true }, "node_modules/unicode-length": { "version": "2.1.0", diff --git a/package.json b/package.json index 316ad5ea..836ea47e 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "tap": "^16.3.7", "tinybench": "^3.0.0", "ts-node": "^10.9.2", - "typescript": "5.6.3" + "typescript": "5.7.2" }, "optionalDependencies": { "@napi-rs/nice": "^1.0.1" diff --git a/src/task_queue/array_queue.ts b/src/task_queue/array_queue.ts index f20814cd..6d215152 100644 --- a/src/task_queue/array_queue.ts +++ b/src/task_queue/array_queue.ts @@ -10,7 +10,7 @@ export class ArrayTaskQueue implements TaskQueue { } shift (): Task | null { - return this.tasks.shift() as Task; + return this.tasks.shift() ?? null; } push (task: Task): void {