title: async/await w/ koa 2 & mongoose
body: <p>I'm currently playing with Koa 2, with the async/await feature. Let's say I have 2 routes, both querying on the DB. One query is a regular &amp; easy one. On the second one here is what I did:</p>
  
  <pre><code>q.$where = `function() {
    var d = new Date((new Date()).getTime() + 2000);
    while (d &gt; (new Date())) { }; return true;}`
  return await this.findOne(q)
  </code></pre>
  
  <p>The <code>$where</code> adds a <strong>2 seconds delay</strong> to simulate a slow query. If I request twice this route (the slow one) like that:</p>
  
  <pre><code>$.get('/api/users/slug')
  $.get('/api/users/slug')
  </code></pre>
  
  <p>The server logs:</p>
  
  <pre><code>&lt;-- GET /api/users/slug
  --&gt; GET /api/users/slug 200 2,004ms 183b // after 2sec
  &lt;-- GET /api/users/slug
  --&gt; GET /api/users/slug 200 2,003ms 183b // after 4sec
  </code></pre>
  
  <p>We see the the second request hits the server after 2 seconds.<br>
  Whereas if I request:</p>
  
  <pre><code>$.get('/api/users/slug')
  $.get('/api/other/route')
  </code></pre>
  
  <p>The other route is doing the same things but without the delay, the server says:</p>
  
  <pre><code>&lt;-- GET /api/users/hugo
  &lt;-- GET /api/other/route
  --&gt; GET /api/other/route 200 3ms 183b
  --&gt; GET /api/users/hugo 200 2,004ms 183b
  </code></pre>
  
  <p>We see the the second request hits the server right after the first one.</p>
  
  <p>I actually expected the first test to give me</p>
  
  <pre><code>&lt;-- GET /api/users/slug
  &lt;-- GET /api/users/slug
  --&gt; GET /api/users/slug 200 2,004ms 183b
  --&gt; GET /api/users/slug 200 2,003ms 183b
  </code></pre>
  
  <p>So the whole thing would have take 2 seconds instead of 4. Do you know why it doesn't?</p>
  
  <p>It's a pretty long question, I tried to give you all the relevant informations. Thx!</p>