I have the following flask server:
from flask import Flask
app = Flask(__name__)
@app.route("/test")
def test():
return 'OK'
app.run()
If I run this with python main.py
and go to localhost:5000/test
in Chrome, sometimes the request completes in 5ms but sometimes it is "stalled" for 300ms.
This seems more likely to happen if I wait between requests (a few minutes) or if I do a hard refresh in Chrome.
I am using:
- Flask: 1.0.2
- Chrome: v72 (with extensions disabled)
- OS: Windows 10
Anyone know what could be causing this or how to fix it (while still using Flask's dev server)?
EDIT
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 localhost
though.