sindresorhus / p-queue

Promise queue with concurrency control
MIT License
3.45k stars 185 forks source link

'next' doesn't work. #118

Closed Pooort closed 3 years ago

Pooort commented 4 years ago

Hi. Here is my example code:

const {default: PQueue} = require('p-queue');

const queue = new PQueue({concurrency: 1});
queue.on('next', () => {
    console.log('NEXT!!!');
});
(async () => {
    await queue.add(() => setTimeout(() => console.log('1'), 500));
    await queue.add(() => setTimeout(() => console.log('2'), 1000));
})();
sindresorhus commented 4 years ago

// @kheyse-oqton

kheyse-werk commented 4 years ago

Hm. I've run your code and got this output:

NEXT!!!
NEXT!!!
1
2

this seems correct to me.

Pooort commented 4 years ago

Wow. So strange. Let me investigate. @kheyse-oqton Thank you for checking.

sindresorhus commented 3 years ago

Closing for now. Happy to look closer into it if you submit a failing test.