Hacker News new | ask | show | jobs
by notdonspaulding 4392 days ago
After reading through this intro, it isn't clear to me if I can use the decorator or context manager to profile code outside the request/response cycle.

Any ideas if that's the case?

1 comments

Not at the moment. Silk doesn't actually save anything down until right at the end of the cycle i.e. in process_response of the middleware. Had to do this to avoid issues with atomic transactions. I certainly don't mind adding this as a feature if people would find that useful - perhaps by detecting that no request is in process and then commiting profile data on the fly if that's the case.