File tree Expand file tree Collapse file tree 2 files changed +12
-14
lines changed
Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -2184,14 +2184,6 @@ export abstract class AbstractPool<
21842184 return workerNodeKey
21852185 }
21862186
2187- private checkAndEmitEmptyEvent ( ) : void {
2188- if ( this . eventTarget != null && this . empty ) {
2189- this . eventTarget . dispatchEvent (
2190- new CustomEvent < PoolInfo > ( PoolEvents . empty , { detail : this . info } ) ,
2191- )
2192- }
2193- }
2194-
21952187 /**
21962188 * Removes the worker node from the pool worker nodes.
21972189 *
@@ -2204,7 +2196,6 @@ export abstract class AbstractPool<
22042196 this . workerChoiceStrategiesContext ?. remove ( workerNodeKey )
22052197 workerNode . info . dynamic &&
22062198 this . checkAndEmitDynamicWorkerDestructionEvents ( )
2207- this . checkAndEmitEmptyEvent ( )
22082199 }
22092200 }
22102201
Original file line number Diff line number Diff line change @@ -61,11 +61,18 @@ export class DynamicThreadPool<
6161
6262 /** @inheritDoc */
6363 protected checkAndEmitDynamicWorkerDestructionEvents ( ) : void {
64- if ( this . eventTarget != null && this . fullEventEmitted && ! this . full ) {
65- this . eventTarget . dispatchEvent (
66- new CustomEvent < PoolInfo > ( PoolEvents . fullEnd , { detail : this . info } ) ,
67- )
68- this . fullEventEmitted = false
64+ if ( this . eventTarget != null ) {
65+ if ( this . fullEventEmitted && ! this . full ) {
66+ this . eventTarget . dispatchEvent (
67+ new CustomEvent < PoolInfo > ( PoolEvents . fullEnd , { detail : this . info } ) ,
68+ )
69+ this . fullEventEmitted = false
70+ }
71+ if ( this . empty ) {
72+ this . eventTarget . dispatchEvent (
73+ new CustomEvent < PoolInfo > ( PoolEvents . empty , { detail : this . info } ) ,
74+ )
75+ }
6976 }
7077 }
7178
You can’t perform that action at this time.
0 commit comments