@rushstack/stream-collator
Advanced tools
Comparing version 4.0.8 to 4.0.9
# Change Log - @rushstack/stream-collator | ||
This log was last generated on Sat, 19 Sep 2020 04:37:27 GMT and should not be manually modified. | ||
This log was last generated on Mon, 21 Sep 2020 17:49:26 GMT and should not be manually modified. | ||
## 4.0.9 | ||
Mon, 21 Sep 2020 17:49:26 GMT | ||
### Patches | ||
- Fix an issue where output was lagged because writers were not activated aggressively enough | ||
## 4.0.8 | ||
@@ -6,0 +13,0 @@ Sat, 19 Sep 2020 04:37:27 GMT |
@@ -89,4 +89,4 @@ /** | ||
private _activeWriter; | ||
private _openBufferedWriters; | ||
private _closedBufferedWriters; | ||
private _openInactiveWriters; | ||
private _closedInactiveWriters; | ||
private _onWriterActive; | ||
@@ -93,0 +93,0 @@ private _preventReentrantCall; |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.9.18" | ||
"packageVersion": "7.9.19" | ||
} | ||
] | ||
} |
@@ -35,4 +35,4 @@ import { TerminalWritable, ITerminalChunk } from '@rushstack/terminal'; | ||
private _activeWriter; | ||
private _openBufferedWriters; | ||
private _closedBufferedWriters; | ||
private _openInactiveWriters; | ||
private _closedInactiveWriters; | ||
private _onWriterActive; | ||
@@ -39,0 +39,0 @@ private _preventReentrantCall; |
@@ -19,6 +19,6 @@ "use strict"; | ||
this._activeWriter = undefined; | ||
// Writers that have accumulated buffered chunks and are not closed yet | ||
this._openBufferedWriters = new Set(); | ||
// Writers that have accumulated buffered chunks and are now closed | ||
this._closedBufferedWriters = new Set(); | ||
// Writers that are not closed yet, and have never been active | ||
this._openInactiveWriters = new Set(); | ||
// Writers that are now closed, but have accumulated buffered chunks, and have never been active | ||
this._closedInactiveWriters = new Set(); | ||
this._preventReentrantCall = false; | ||
@@ -64,2 +64,8 @@ this.destination = options.destination; | ||
this._taskNames.add(writer.taskName); | ||
// When a task is initially registered, it is open and has not accumulated any buffered chunks | ||
this._openInactiveWriters.add(writer); | ||
if (this._activeWriter === undefined) { | ||
// If there is no active writer, then the first one to be registered becomes active. | ||
this._assignActiveWriter(writer); | ||
} | ||
return writer; | ||
@@ -78,5 +84,2 @@ } | ||
else { | ||
if (bufferedChunks.length === 0) { | ||
this._openBufferedWriters.add(writer); | ||
} | ||
bufferedChunks.push(chunk); | ||
@@ -92,6 +95,6 @@ } | ||
// If any buffered writers are already closed, activate them each immediately | ||
for (const closedBufferedWriter of [...this._closedBufferedWriters]) { | ||
this._closedBufferedWriters.delete(closedBufferedWriter); | ||
// We copy the set, since _assignActiveWriter() will be deleting from it. | ||
for (const closedInactiveWriter of [...this._closedInactiveWriters]) { | ||
try { | ||
this._assignActiveWriter(closedBufferedWriter); | ||
this._assignActiveWriter(closedInactiveWriter); | ||
} | ||
@@ -102,17 +105,24 @@ finally { | ||
} | ||
// Find a buffered writer and activate it | ||
let openBufferedWriter = undefined; | ||
for (const first of this._openBufferedWriters) { | ||
openBufferedWriter = first; | ||
break; | ||
let writerToActivate = undefined; | ||
// Try to activate a writer that already accumulated some data | ||
for (const openInactiveWriter of this._openInactiveWriters) { | ||
if (openInactiveWriter.bufferedChunks.length > 0) { | ||
writerToActivate = openInactiveWriter; | ||
break; | ||
} | ||
} | ||
if (openBufferedWriter) { | ||
this._assignActiveWriter(openBufferedWriter); | ||
if (!writerToActivate) { | ||
// Otherwise just take the first one | ||
for (const openInactiveWriter of this._openInactiveWriters) { | ||
writerToActivate = openInactiveWriter; | ||
break; | ||
} | ||
} | ||
if (writerToActivate) { | ||
this._assignActiveWriter(writerToActivate); | ||
} | ||
} | ||
else { | ||
if (writer.bufferedChunks.length > 0) { | ||
this._openBufferedWriters.delete(writer); | ||
this._closedBufferedWriters.add(writer); | ||
} | ||
this._openInactiveWriters.delete(writer); | ||
this._closedInactiveWriters.add(writer); | ||
} | ||
@@ -122,3 +132,4 @@ } | ||
this._activeWriter = writer; | ||
this._openBufferedWriters.delete(writer); | ||
this._closedInactiveWriters.delete(writer); | ||
this._openInactiveWriters.delete(writer); | ||
if (this._onWriterActive) { | ||
@@ -125,0 +136,0 @@ this._preventReentrantCall = true; |
{ | ||
"name": "@rushstack/stream-collator", | ||
"version": "4.0.8", | ||
"version": "4.0.9", | ||
"description": "Display intelligible realtime output from concurrent processes", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
191446
4747