File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import { resolve } from 'node:path';
44import { inspect , types } from 'node:util' ;
55import { performance } from 'node:perf_hooks' ;
66import { setTimeout as sleep } from 'node:timers/promises' ;
7- import assert from 'node:assert' ;
87
98import { version } from '../package.json' ;
109import type {
@@ -444,7 +443,10 @@ class ThreadPool {
444443 if ( workerInfo . currentUsage ( ) === 0 &&
445444 this . workers . size > this . options . minThreads ) {
446445 workerInfo . idleTimeout = setTimeout ( ( ) => {
447- assert . strictEqual ( workerInfo . currentUsage ( ) , 0 ) ;
446+ if ( workerInfo . currentUsage ( ) !== 0 ) {
447+ // Exit early - we can't safely remove the worker.
448+ return ;
449+ }
448450 if ( this . workers . size > this . options . minThreads ) {
449451 this . _removeWorker ( workerInfo ) ;
450452 }
You can’t perform that action at this time.
0 commit comments