sindresorhus / p-queue

Promise queue with concurrency control
MIT License
3.41k stars 182 forks source link

Added ability to stop processing when task returns an error #150

Closed Stono closed 3 years ago

Stono commented 3 years ago

Hey, As the title says, this adds an option to be able to stop processing when we encounter an error. This is quite important for me as i'm trying to do a fifo queue that stops on error.

Ta

Stono commented 3 years ago

Side note, I've made a breaking change in the package.json that's selfish.

The use of "type": "module" breaks my use of p-queue so hard, the current support of esm in ts-node etc is flakey at best and there's no clear path to migration. I'm curious why you added it in v7 as I'm really unclear what benefits it gives!

I fully understand if you don't want to merge this in, in which case I'll keep working from my branch until such a time support for modules is less of a mine field.

Stono commented 3 years ago
❯ ./node_modules/.bin/ts-node lib/index.ts                                                              
/Users/karl.stoney/git/github/melongene/sink/node_modules/p-queue/dist/index.js:1
import EventEmitter from 'eventemitter3';
^^^^^^

SyntaxError: Cannot use import statement outside a module

Gah.... now i see. Will close this PR and find an alternative.

vitoorgomes commented 1 year ago

did you find any alternatives to it? @Stono