django-commons/django-prometheus

Hanged DB connections due to early ConnectionHandler initalization

Opened this issue · 0 comments

migrations.py imports connections at a module level that leads to ConnectionHandler initialization and creation of DB connection.
apps.py imports migrations.py so ConnectionHandler are being initialized on each stage of application initialization.
It seems like the import of ExportMigrations should be changed to function-level as it is described in documentation.
PS PROMETHEUS_EXPORT_MIGRATIONS option change have no effect to this behaviour.