Closed gajus closed 4 years ago
setInterval(() => { console.log('>>>', [queue.size, queue.pending]); }, 1000); await queue.onIdle(async () => { console.log('IDLE'); });
With this code, I get:
>>> [ 1, 5 ] >>> [ 0, 5 ] >>> [ 0, 4 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 3 ] >>> [ 0, 2 ] >>> [ 0, 1 ] >>> [ 0, 0 ] >>> [ 0, 0 ] >>> [ 0, 0 ]
I expect to see IDLE after first >>> [ 0, 0 ].
IDLE
>>> [ 0, 0 ]
Never mind. I have misread the documentation. There is no callback. It should have been:
setInterval(() => { console.log('>>>', [queue.size, queue.pending]); }, 1000); await queue.onIdle(); console.log('IDLE');
With this code, I get:
I expect to see
IDLE
after first>>> [ 0, 0 ]
.