Skip to content

Commit

Permalink
Fix issue where BufferedEmitter would not deliver buffered events
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Aug 26, 2019
1 parent 0cf92dc commit 185308c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/vs/base/parts/ipc/common/ipc.net.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ export class BufferedEmitter<T> {
// it is important to deliver these messages after this call, but before
// other messages have a chance to be received (to guarantee in order delivery)
// that's why we're using here nextTick and not other types of timeouts
process.nextTick(() => this._deliverMessages);
process.nextTick(() => this._deliverMessages());
},
onLastListenerRemove: () => {
this._hasListeners = false;
Expand All @@ -443,7 +443,11 @@ export class BufferedEmitter<T> {

public fire(event: T): void {
if (this._hasListeners) {
this._emitter.fire(event);
if (this._bufferedMessages.length > 0) {
this._bufferedMessages.push(event);
} else {
this._emitter.fire(event);
}
} else {
this._bufferedMessages.push(event);
}
Expand Down

0 comments on commit 185308c

Please sign in to comment.