sindresorhus / p-queue

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

UnhandledPromiseRejectionWarning #119

Closed joshuambg closed 4 years ago

joshuambg commented 4 years ago

This happens after using clear on a large queue.

(node:17512) UnhandledPromiseRejectionWarning: TypeError: this._queue.dequeue(...) is not a function
    at Crawl._tryToStartAnother (D:\myproject\node_modules\p-queue\dist\index.js:101:38)
    at Crawl._next (D:\myproject\node_modules\p-queue\dist\index.js:48:14)
    at run (D:\myproject\node_modules\p-queue\dist\index.js:164:22)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:17512) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:17512) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

> npm list p-queue
-- p-queue@6.6.1
> node --version
v12.18.3
> npm --version
6.14.6
sindresorhus commented 4 years ago

I was not able to reproduce. But I did try to make the code safer. Could you try out the latest release? https://github.com/sindresorhus/p-queue/releases/tag/v6.6.2