Skip to content

Commit 2352ff6

Browse files
author
Sebastian McKenzie
committed
add message to blocking queue when resolved a queue that was reported as stuck - fixes #117
1 parent 2140fe8 commit 2352ff6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/util/blocking-queue.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default class BlockingQueue {
1616
this.concurrencyQueue = [];
1717
this.maxConcurrency = maxConcurrency;
1818
this.runningCount = 0;
19+
this.warnedStuck = false;
1920
this.alias = alias;
2021
this.first = true;
2122

@@ -24,6 +25,7 @@ export default class BlockingQueue {
2425
}
2526

2627
concurrencyQueue: Array<Function>;
28+
warnedStuck: boolean;
2729
maxConcurrency: number;
2830
runningCount: number;
2931
stuckTimer: ?number;
@@ -49,6 +51,7 @@ export default class BlockingQueue {
4951

5052
this.stuckTimer = setTimeout(() => {
5153
if (this.runningCount === 1) {
54+
this.warnedStuck = true;
5255
console.warn(
5356
`[fbkpm] The ${JSON.stringify(this.alias)} blocking queue may be stuck. 5 seconds ` +
5457
`without any activity with 1 worker: ${Object.keys(this.running)[0]}`
@@ -79,6 +82,13 @@ export default class BlockingQueue {
7982
if (this.running[key]) {
8083
delete this.running[key];
8184
this.runningCount--;
85+
86+
if (this.warnedStuck) {
87+
this.warnedStuck = false;
88+
console.log(
89+
`[fbkpm] ${JSON.stringify(this.alias)} blocking queue finally resolved. Nothing to worry about.`
90+
);
91+
}
8292
}
8393

8494
let queue = this.queue[key];

0 commit comments

Comments
 (0)