#34159 closed New feature (wontfix)
Django potential improvement - views decorator for http_timeout with auto retry
Reported by: | JDonMc | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | 4.1 |
Severity: | Normal | Keywords: | views decorator timeout |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | yes |
Description
Sometimes django views take 30+ seconds to load, and then timeout.
The weird thing is, that you can refresh the page from a browser, and it will load in less than a second.
Because it's non-deterministic, it's really hard to solve.
Ideally I'd set a timer so that any request that takes 4+ seconds to solve is killed and retried,
and a secondary timer so that any request that has been retried 7 times redirects to an error page,
on the error page implement some javascript to re-request the page.
I understand it's a bit much, but the first thing is important to me.
Most 99% of my requests are under 2 seconds,
but for some reason at random intervals it hits 30+ and sends an 503 error,
But it's non-deterministic because that same page can still be loaded exactly the same within 2 seconds.
I think this would work well as a third-party app. Certainly prototyping it there would be appropriate, following up on the DevelopersMailingList to discuss inclusion at that point.
For the simpler case, perhaps a WSGI Middleware would be the easiest thing to add?