Hello, I'd like to start a discussion about the ticket I created https://code.djangoproject.com/ticket/30646 that was closed as won't fix.
Essentially the ticket is about how to handle database disconnects. These can happen for a variety of reasons such as network problems or failover from a master to a replica. It took us quite some time until we figured out how to handle this reasonably and we now do this through a combination of: * Checking whether connection is usable (what the ticket and the associated PR do) * Exponential backoff and retry * A middleware that detects database errors that are likely transient and turns them into 503 with Retry-After in situations where retrying would introduce unreasonably high latency Given that Django aims to be a full-stack framework for "perfectionists with deadlines", I think this is complexity that should move into the framework. At the very least it should be seriously considered. SQLAlchemy, while not addressing the problem fully, covers this problem in detail in their documentation https://docs.sqlalchemy.org/en/13/core/pooling.html#dealing-with-disconnects. The "pre ping" approach mentioned there would correspond to what I've proposed in the ticket and the associated PR. Kind regards, Daniel -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/cc0bd0bb-38f9-4ce3-84f5-d45c415d390c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.