Skip to content

If completer rejects, callback is called twice #51

Description

@jwalton

I was just browsing through the code and came across this:

    result.catch(cb).then(function (result) {
      process.nextTick(function () { cb(null, result) })
    }

So, if result rejects, we'll .catch(cb) and call the callback, but then .then(function(result) {... will be called with whatever cb returns, so we'll call cb again next tick. This should be:

    result.then(
      function (result) {
        process.nextTick(function () { cb(null, result) })
      },
      cb
    );

(Edit to add link to code)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions