title: node.js async.js nextTick vs setImmediate
body: <p>I have a large node.js application that heavily uses the async.js module.  </p>
  
  <p>I have a lot of code like this:</p>
  
  <pre><code>async.series([
      function(callback){
          sql.update(query, callback);
      },
      function(callback){
          if (something){
              sql.update(query2, callback);
          }
          else{
              callback(null);
          }
      }
  </code></pre>
  
  <p>]);</p>
  
  <p>The big problem is the synchronous callback in the else statement.  I read a while back that you should not do that with async.js as it could cause unexpected results, but I'm not sure what the best alternative is.  I read that I should use process.nextTick in some places, but now I'm reading that we should not use that and it should be setImmediate.  </p>
  
  <p>Can someone point me in the right direction?  Thanks!</p>