mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Guard against recorder pool current connection disappearing during global destruction (#71971)
This commit is contained in:
parent
007c6d2236
commit
f4a2afeb37
@ -55,7 +55,12 @@ class RecorderPool(SingletonThreadPool, NullPool): # type: ignore[misc]
|
||||
|
||||
def shutdown(self) -> None:
|
||||
"""Close the connection."""
|
||||
if self.recorder_or_dbworker and self._conn and (conn := self._conn.current()):
|
||||
if (
|
||||
self.recorder_or_dbworker
|
||||
and self._conn
|
||||
and hasattr(self._conn, "current")
|
||||
and (conn := self._conn.current())
|
||||
):
|
||||
conn.close()
|
||||
|
||||
def dispose(self) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user