Open kesavkolla opened 7 years ago
Yes, that's by design. It runs after the view finished, and response is rendered but as it accepts the request which is bound to response, it needs to block it, otherwise the objects could be gone already.
This is not the API you are looking for. As a workaround use threads instead. I have in my mind some future offloading APIs but this one is bound to request - response lifecycle. It could have been named better.
I had to do some heavy work after sending request response. I added add_done_callback to request and wrote work intensive task. The response didn't sent to client till the add_done_callback is done. Here is the code I've:
I was expecting the done response will be immediately sent to client. The response was held up since the callback is not done.