title: How to set maximum number of pending connections in Flask
body: <p>How can I set a maximum number of pending connections in a Flask application?</p>
  
  <p>E.g.</p>
  
  <p>After I run this code, I can send it two requests at the same time. While the first request is being processed, the other one will wait. When the first one is done, the second one will be processed.</p>
  
  <pre><code>from flask import Flask
  application = Flask(__name__)
  
  
  @application.route("/")
  def hello():
      for x in range(10000000):
          x += 1
      return "Hello World!"
  
  
  if __name__ == '__main__':
      application.run()
  </code></pre>
  
  <p>How can I make it so that when I send two requests at the same time, the first one will be processed and the second one, instead of waiting, will not be able to connected (maybe it will get a some kind of error instead).</p>