rethinkdb-example-nodejs-chat icon indicating copy to clipboard operation
rethinkdb-example-nodejs-chat copied to clipboard

nextTick() used 'for effect' - is this necessary, if so, why?

Open mikemaccana opened this issue 8 years ago • 2 comments

https://github.com/rethinkdb/rethinkdb-example-nodejs-chat/blob/master/app.js#L48 has

passport.use(new local(
  function(username, password, done) {
    // asynchronous verification, for effect...
    process.nextTick(function () {

Is the nextTick() actually necessary, or is it 'for effect'?

  • If it's necessary, why is it necessary? The comment is very vague.
  • If it's not necessary, should the nextTick be removed?

Thanks for taking the time to answer this - I understand what nextTick() does, but it's not apparent why it's being used here.

mikemaccana avatar Mar 23 '16 14:03 mikemaccana

It doesn't look like it's necessary for the basic functionality, but I guess that it still servers some purpose (could it be making some transition look nicer in the UI?).

If @al3xandru wants to chime in, he might remember more about this.

danielmewes avatar Mar 24 '16 00:03 danielmewes

Ah that makes sense I see @al3xandru in the git blame - Alex do you know why this is needed? Thanks!

mikemaccana avatar Mar 25 '16 19:03 mikemaccana