passport.js and process.nextTick in strategy

Viewed 2968

I'm facing something new in nodeJS: process.nextTick

In some strategies code examples for passport.js, we can see

passport.use(new LocalStrategy(
  function (username, password, done) {

    // asynchronous verification, for effect...
    process.nextTick(function () {

      findByUsername(username, function (err, user) {
        // ...
        bcrypt.compare(password, user.password, function (err, res) {
          // ...
        });
      })
    });
  }
));

But in the official documentation, it is not used. (http://passportjs.org/guide/username-password/)

What I understand is that process.nextTick should be used to defer synchronous stack to not block an event. But in this strategy code, there is no event.

What the benefit of doing that here ?

2 Answers
Related