question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

async.queue with async arrow function without callback doesn't work

See original GitHub issue

What version of async are you using? 3.2.0

Which environment did the issue occur in (Node/browser/Babel/Typescript version) Node.js

What did you do? Please include a minimal reproducible case illustrating issue.

// Some code has been abbreviated for legibility

// Cleanup lingering test data
before(async () => {
  const docs = await cosmosClient.queryAll(...);

  const q = async.queue(async (task) => {
    await cosmosClient.deleteItem(task.doc.id);
  }, 10);

  q.push(docs.map((doc, idx) => ({ doc, idx })));
  await q.drain();
});

What did you expect to happen? all documents added to queue to be processed and for test suite to continue

What was the actual result? only first 10 documents are processed and then Node.js exists after a bit of time.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

2reactions
aearlycommented, Jan 12, 2021

Yep, that’s correct. If you’re using a recent version of Node (> 8.x), you can probably set TS’s target to preserve async functions/

1reaction
silveojcommented, Feb 5, 2021

I set in tsconfig.json (or higher)

    "target": "es2017",
    "lib": ["es2017", "DOM"],
Read more comments on GitHub >

github_iconTop Results From Across the Web

async.queue with async handler function - callback argument ...
When I remove async /await from the top function section, it works, but I can't call my long-running task :-( I have no...
Read more >
41 Async functions - Exploring JS
The reason is that normal arrow functions don't allow await inside their bodies. OK, let's try an async arrow function then: async function...
Read more >
How to use the async.queue function in async - Snyk
To help you get started, we've selected a few async.queue examples, based on popular ways it is used in public projects.
Read more >
Understanding the Event Loop, Callbacks, Promises, and ...
An async function can handle a promise called within it using the await operator. await can be used within an async function and...
Read more >
caolan/async - Gitter
Hi @nikkitan I think the short answer is no, the entire library has not been merge into the latest version onf javascript. the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found