Skip to content

Commit

Permalink
Fix AsyncResource propagation issue
Browse files Browse the repository at this point in the history
Fixes: #200
  • Loading branch information
hyperair committed Oct 30, 2023
1 parent 38a6773 commit 4e0de89
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Queue from 'yocto-queue';
import { AsyncResource } from 'async_hooks';

Check failure on line 2 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 16

`async_hooks` import should occur before import of `yocto-queue`

Check failure on line 2 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 16

There should be no space after '{'.

Check failure on line 2 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 16

There should be no space before '}'.

Check failure on line 2 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 16

Prefer `node:async_hooks` over `async_hooks`.

export default function pLimit(concurrency) {
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
Expand Down Expand Up @@ -31,7 +32,9 @@ export default function pLimit(concurrency) {
};

const enqueue = (fn, resolve, args) => {
queue.enqueue(run.bind(undefined, fn, resolve, args));
queue.enqueue(
AsyncResource.bind(run.bind(undefined, fn, resolve, args))

Check failure on line 36 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 16

Missing trailing comma.
);

(async () => {
// This function needs to wait until the next microtask before comparing
Expand Down

0 comments on commit 4e0de89

Please sign in to comment.