@matrixai/workers
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -17,2 +17,4 @@ import type { ModuleThread } from 'threads'; | ||
* the function expression is defined | ||
* If `cores` is set to 0, this creates a useless worker pool | ||
* Use `undefined` to mean using all cores | ||
*/ | ||
@@ -35,3 +37,5 @@ static createWorkerManager<W extends ModuleMethods>({ workerFactory, cores, logger, }: { | ||
get destroyed(): boolean; | ||
destroy(): Promise<void>; | ||
destroy({ force, }?: { | ||
force?: boolean; | ||
}): Promise<void>; | ||
call<T>(f: (worker: ModuleThread<W>) => Promise<T>): Promise<T>; | ||
@@ -38,0 +42,0 @@ queue<T>(f: (worker: ModuleThread<W>) => Promise<T>): QueuedTask<ModuleThread<W>, T>; |
@@ -45,2 +45,4 @@ "use strict"; | ||
* the function expression is defined | ||
* If `cores` is set to 0, this creates a useless worker pool | ||
* Use `undefined` to mean using all cores | ||
*/ | ||
@@ -61,3 +63,3 @@ static async createWorkerManager({ workerFactory, cores, logger = new logger_1.default(this.name), }) { | ||
} | ||
async destroy() { | ||
async destroy({ force = false, } = {}) { | ||
if (this._destroyed) { | ||
@@ -67,3 +69,3 @@ return; | ||
this.logger.info('Destroying WorkerManager'); | ||
await this.pool.terminate(); | ||
await this.pool.terminate(force); | ||
this._running = false; | ||
@@ -70,0 +72,0 @@ this._destroyed = true; |
{ | ||
"name": "@matrixai/workers", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"author": "Roger Qiu", | ||
@@ -14,3 +14,3 @@ "description": "Multithreaded Workers", | ||
"scripts": { | ||
"build": "tsc -p ./tsconfig.build.json", | ||
"build": "rm -r ./dist || true; tsc -p ./tsconfig.build.json", | ||
"ts-node": "ts-node -r tsconfig-paths/register", | ||
@@ -20,7 +20,7 @@ "test": "jest", | ||
"lintfix": "eslint '{src,tests,benches}/**/*.{js,ts}' --fix", | ||
"docs": "typedoc --tsconfig ./tsconfig.build.json --out ./docs src && touch ./docs/.nojekyll", | ||
"docs": "rm -r ./docs || true; typedoc --gitRevision master --tsconfig ./tsconfig.build.json --out ./docs src && touch ./docs/.nojekyll", | ||
"bench": "ts-node -r tsconfig-paths/register ./benches" | ||
}, | ||
"dependencies": { | ||
"@matrixai/logger": "^2.0.1", | ||
"@matrixai/logger": "^2.1.0", | ||
"threads": "^1.6.5", | ||
@@ -27,0 +27,0 @@ "ts-custom-error": "^3.2.0" |
Sorry, the diff of this file is not supported yet
31300
286
Updated@matrixai/logger@^2.1.0