title: Flask requests are stalled for 300ms
body: <p>I have the following flask server:</p>
  
  <pre><code>from flask import Flask
  
  app = Flask(__name__)
  
  @app.route("/test")
  def test():
      return 'OK'
  
  app.run()
  </code></pre>
  
  <p>If I run this with <code>python main.py</code> and go to <code>localhost:5000/test</code> in Chrome, sometimes the request completes in 5ms but sometimes it is "stalled" for 300ms.</p>
  
  <p><a href="https://i.stack.imgur.com/qXjiq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qXjiq.png" alt="Flask network traffic"></a></p>
  
  <p>This seems more likely to happen if I wait between requests (a few minutes) or if I do a hard refresh in Chrome.</p>
  
  <p>I am using:</p>
  
  <ul>
  <li>Flask: 1.0.2</li>
  <li>Chrome: v72 (with extensions disabled)</li>
  <li>OS: Windows 10</li>
  </ul>
  
  <p>Anyone know what could be causing this or how to fix it (while still using Flask's dev server)?</p>
  
  <p><strong>EDIT</strong>
  I tried using 127.0.0.1 (as suggested by Sraw) and the 300ms delay went away. I'm still curious why this isn't working with <code>localhost</code> though.</p>