As we run databases in Kubernetes (using https://github.com/zalando
/postgres-operator), a database failover is not an unusual scenario and
not of any concern. However on employee-facing internal applications that
see relatively low traffic, this leads to a number of requests failing
with 500s on every failover. We've patched this in our applications but it
would be nice to see this fixed in Django itself.
Fixing this does incur the cost of a roundtrip to the database with every
request but this doesn't appear to have any significant impact on latency.
--
Ticket URL: <https://code.djangoproject.com/ticket/30646>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by dneuhaeuser-zalando):
I've created a PR to fix the problem:
https://github.com/django/django/pull/11573
--
Ticket URL: <https://code.djangoproject.com/ticket/30646#comment:1>
Comment (by Simon Charette):
Hello there,
> Fixing this does incur the cost of a roundtrip to the database with
every request but this doesn't appear to have any significant impact on
latency.
I'm afraid we can't take an anecdotical report about effects on your setup
to stand for most of other setups out there. What if someone reports that
it significantly affects ''their'' setup?
I guess we could add a flag to `close_if_unusable_or_obsolete` for this
purpose but it seems wasteful to perform this check on every request. If
we decide that this should be done we should at least move the ''
obsolescence '' check before the ''usable'' one since the former doesn't
require any database interactions and will be reached on all requests when
`CONN_MAX_AGE=0` which is the default.
--
Ticket URL: <https://code.djangoproject.com/ticket/30646#comment:2>
* status: new => closed
* resolution: => wontfix
Comment:
Thanks for the report, however I agree with Simon that checking this on
every request seems like an overkill.
Please write to the DevelopersMailingList if you want other opinions, we
can re-open this ticket if we reach a consensus on the mailing list.
--
Ticket URL: <https://code.djangoproject.com/ticket/30646#comment:3>