title: How to handle async concurrent requests correctly?
body: <p>Let's say I have some sort of game. I have a buyItem function like this:</p>
  
  <pre><code>buyItem: function (req, res) {
      // query the users balance
      // deduct user balance
      // buy the item
  }
  </code></pre>
  
  <p>If I spam that route until the user balance is deducted (the 2nd query) the user's balance is still positive.</p>
  
  <p>What I have tried:</p>
  
  <pre><code>buyItem: function (req, res) {
      if(req.session.user.busy) return false;
      req.session.user.busy = true;
      // query the users balance
      // deduct user balance
      // buy the item
  }
  </code></pre>
  
  <p>The problem is <code>req.session.user.busy</code> will be <code>undefined</code> for the first ~5 requests. So that doesn't work either.</p>
  
  <p>How do we handle such situations? I'm using the Sails.JS framework if that is important.</p>