Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pushing nil asynchronously to short-circuit a stream cause deadlock #563

Open
vqvu opened this issue Oct 29, 2016 · 0 comments
Open

Pushing nil asynchronously to short-circuit a stream cause deadlock #563

vqvu opened this issue Oct 29, 2016 · 0 comments

Comments

@vqvu
Copy link
Collaborator

vqvu commented Oct 29, 2016

This code doesn't work. "done" is never printed.

_([1])
  .consume(function (err, x, push, next) {
    if (err) {
      push(err);
      next();
    } else if (x === _.nil) {
      push(null, _.nil);
    } else {
      setTimeout(function () {
        push(null, _.nil);
      }, 0);
    }
  })
  .done(function () {
    console.log('done');
  });

Spotted when looking at #558.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant