Database-Connections time out in long running Applications without request context.
|Reported by:||kahnert||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.6|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If you use the Django-ORM outside of request handling, in uWSGI mules for example, connections time out. The expected behavior would be to reconnect on the next command issued.
But because the checks for unusable connections is bound to request signals those get never called.
An easy solution would be to call self.close_if_unusable_or_obsolete() at first in BaseDatabaseWrapper.ensure_connection.