How to serve no more that one HTTP request in python?
<p>I have a simple HTTP server setup like <a href="http://stackoverflow.com/a/11769969">this one</a>. It processes a slow 40 second request to open and then close gates (real metallic gates). If second HTTP query is made during execution of the first one, it is placed in queue and then executed after first run. I don't need this behavior, I need to reply with error if gate open/close procedure is in progress now.
How can I do that? There's a parameter 'request_queue_size' - but I'm not sure how to set it.</p>

<p>You need to follow a different strategy designing your server service.  You need to keep the state of the door either in memory or in a database.  Then, each time you receive a request to do something on the door, you check the current state of the door in your persistence, and then you execute the action if it is possible to do on the current state, otherwise you return an error.  Also, don't forget to update the state of the door once an action completes. </p>

python