Async: Iteratee never called in async.whilst

Created on 19 Jun 2019  路  1Comment  路  Source: caolan/async

What version of async are you using?
3.0.1

Which environment did the issue occur in (Node version/browser version)
node.js v8.11.4

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

Bog standard async.whilst use:

async.whilst(
      () => { return true; }
      (callback) => { callback(); }
      (error) => { console.log('Done'); });

Every single async.whilst loop is not calling the iteratee function. Also the result function is never called, resulting in the application simply being stalled. This used to work before updating to the latest async version.

Update: after downgrading to async 2.x the code works again.

Most helpful comment

In v3, the test function must be an async function, e.g.

async.whilst(
      (cb) => { cb (null, true) }
      (callback) => { callback(); }
      (error) => { console.log('Done'); });

or

async.whilst(
      async () => { return true; }
      (callback) => { callback(); }
      (error) => { console.log('Done'); });

>All comments

In v3, the test function must be an async function, e.g.

async.whilst(
      (cb) => { cb (null, true) }
      (callback) => { callback(); }
      (error) => { console.log('Done'); });

or

async.whilst(
      async () => { return true; }
      (callback) => { callback(); }
      (error) => { console.log('Done'); });
Was this page helpful?
0 / 5 - 0 ratings