In Django, if the view uses a sleep() function while answering a request, does this block the handling of the whole queue of requests?
If so, how to delay an http answer without this blocking behavior? Can we do that out-of-the-box and avoid using a job queue like Celeri?
I would image that calling sleep()
should block the execution of all Django code in most cases. However it might depend on the deployment architecture (e.g. gevent, gunicorn, etc). For instance if you are using a server which fires Django threads for each request, then no it will not block all the code.
In most cases however using something like Celeri would like to be a much better solution because (1) don't reinvent the wheel and (2) it has been tested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With