@lage-run/worker-threads-pool
Advanced tools
Comparing version 0.8.5 to 0.8.6
@@ -5,3 +5,18 @@ { | ||
{ | ||
"date": "Wed, 04 Dec 2024 23:49:59 GMT", | ||
"date": "Sun, 08 Dec 2024 00:07:13 GMT", | ||
"version": "0.8.6", | ||
"tag": "@lage-run/worker-threads-pool_v0.8.6", | ||
"comments": { | ||
"patch": [ | ||
{ | ||
"author": "kchau@microsoft.com", | ||
"package": "@lage-run/worker-threads-pool", | ||
"commit": "e6eaba8d27f25d746caed332198519a7dc4a218e", | ||
"comment": "adds the ability to do workerIdleMemoryLimit" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Wed, 04 Dec 2024 23:50:15 GMT", | ||
"version": "0.8.5", | ||
@@ -8,0 +23,0 @@ "tag": "@lage-run/worker-threads-pool_v0.8.5", |
# Change Log - @lage-run/worker-threads-pool | ||
<!-- This log was last generated on Wed, 04 Dec 2024 23:49:59 GMT and should not be manually modified. --> | ||
<!-- This log was last generated on Sun, 08 Dec 2024 00:07:13 GMT and should not be manually modified. --> | ||
<!-- Start content --> | ||
## 0.8.6 | ||
Sun, 08 Dec 2024 00:07:13 GMT | ||
### Patches | ||
- adds the ability to do workerIdleMemoryLimit (kchau@microsoft.com) | ||
## 0.8.5 | ||
Wed, 04 Dec 2024 23:49:59 GMT | ||
Wed, 04 Dec 2024 23:50:15 GMT | ||
@@ -11,0 +19,0 @@ ### Patches |
@@ -15,2 +15,3 @@ /// <reference types="node" /> | ||
workerIdleMemoryLimit?: number; | ||
workerIdleMemoryLimitPercentage?: number; | ||
} | ||
@@ -17,0 +18,0 @@ export declare class ThreadWorker extends EventEmitter implements IWorker { |
@@ -19,3 +19,3 @@ "use strict"; | ||
const _crypto = /*#__PURE__*/ _interop_require_default(require("crypto")); | ||
const _os = /*#__PURE__*/ _interop_require_default(require("os")); | ||
const _v8 = /*#__PURE__*/ _interop_require_default(require("v8")); | ||
function _check_private_redeclaration(obj, privateCollection) { | ||
@@ -90,2 +90,3 @@ if (privateCollection.has(obj)) { | ||
const workerFreeEvent = "free"; | ||
const maxOldSpaceSizeBytes = _v8.default.getHeapStatistics().total_available_size; | ||
var _taskInfo = /*#__PURE__*/ new WeakMap(), _stdoutInfo = /*#__PURE__*/ new WeakMap(), _stderrInfo = /*#__PURE__*/ new WeakMap(), // @ts-ignore TS2564 | ||
@@ -182,2 +183,5 @@ _worker = /*#__PURE__*/ new WeakMap(), _createNewWorker = /*#__PURE__*/ new WeakSet(), _ready = /*#__PURE__*/ new WeakSet(), _captureWorkerStdioStreams = /*#__PURE__*/ new WeakSet(), _handleAbort = /*#__PURE__*/ new WeakSet(); | ||
}), this.status = "busy", this.restarts = 0, this.maxWorkerMemoryUsage = 0; | ||
if (!options.workerIdleMemoryLimitPercentage) { | ||
options.workerIdleMemoryLimitPercentage = 80; | ||
} | ||
_class_private_method_get(this, _createNewWorker, createNewWorker).call(this); | ||
@@ -225,3 +229,4 @@ } | ||
this.maxWorkerMemoryUsage = Math.max(this.maxWorkerMemoryUsage, data.memoryUsage); | ||
const limit = this.options.workerIdleMemoryLimit ?? _os.default.totalmem(); | ||
const workerMaxOldGenSizeMb = _class_private_field_get(this, _worker).resourceLimits?.maxOldGenerationSizeMb; | ||
const limit = this.options.workerIdleMemoryLimit ?? (workerMaxOldGenSizeMb ? workerMaxOldGenSizeMb * 1024 * 1024 : maxOldSpaceSizeBytes) * this.options.workerIdleMemoryLimitPercentage / 100; | ||
if (limit && data.memoryUsage > limit) { | ||
@@ -228,0 +233,0 @@ this.restart(); |
{ | ||
"name": "@lage-run/worker-threads-pool", | ||
"version": "0.8.5", | ||
"version": "0.8.6", | ||
"description": "A worker_threads pool implementation based on the official Node.js async_hooks documentation", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
97274
1528
2