Non Blocking calls using Tornado and Python Eve
<p>I have a Eve Application with Tornado. </p>

<pre><code>http_server = HTTPServer(WSGIContainer(app))
http_server.listen(5000)
IOLoop.instance().start()
</code></pre>

<p>I make a post call on of my API that takes a long time and sends a mail to the user when the process is done.
How can I make the call non blocking so that the user do not have to wait.</p>

<p>Thanks
DC </p>

<p>Eve is written in Flask so by design it's blocking code and there's no simple way to make it magically non-blocking. Running your eve project in tornado will not help either. You can however use <a href="http://gunicorn.org/" rel="nofollow"><code>gunicorn</code></a> or <a href="https://hendrix.readthedocs.io/en/latest/" rel="nofollow"><code>hendrix</code></a> which can fork your <code>wsgi</code> app, act like a proxy, and make it seem like your project is running in a non-blocking manner. But I recommend using an async/threaded task runner (something like <a href="http://docs.celeryproject.org/en/latest/index.html" rel="nofollow"><code>celery</code></a>) to send the mail. This method will require you to rewrite your mailing functions using the task runner. I hope this helps, if not please provide some more examples of what your code does and maybe we can help.</p>

python tornado eve