Question

Using Pyramid with Akhet, how do I execute a method after a response has been returned to the client? I believe this was done with the __after__ method in Pylons. I'm trying to execute a DB query and don't want it to block the request response.

No correct solution

OTHER TIPS

You can use a response callback for your case.

EDITED after Michael Merickel's comment: The response callback blocks the request to which is added, but you shouldn't worry about that callback blocking other requests since each request runs in a different thread. If you still need not to block the request with the callback, you can spawn a different thread or process (if you can afford it) or look into message queuing systems as mentioned in the comment below.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top