mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Fix leak of SQLAlchemy engine objects in recorder (#121085)
This commit is contained in:
parent
48172b0426
commit
61f1c8d963
@ -960,6 +960,7 @@ class Recorder(threading.Thread):
|
|||||||
tries += 1
|
tries += 1
|
||||||
|
|
||||||
if tries <= self.db_max_retries:
|
if tries <= self.db_max_retries:
|
||||||
|
self._close_connection()
|
||||||
time.sleep(self.db_retry_wait)
|
time.sleep(self.db_retry_wait)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
@ -1452,6 +1453,7 @@ class Recorder(threading.Thread):
|
|||||||
if self._using_file_sqlite:
|
if self._using_file_sqlite:
|
||||||
validate_or_move_away_sqlite_database(self.db_url)
|
validate_or_move_away_sqlite_database(self.db_url)
|
||||||
|
|
||||||
|
assert not self.engine
|
||||||
self.engine = create_engine(self.db_url, **kwargs, future=True)
|
self.engine = create_engine(self.db_url, **kwargs, future=True)
|
||||||
self._dialect_name = try_parse_enum(SupportedDialect, self.engine.dialect.name)
|
self._dialect_name = try_parse_enum(SupportedDialect, self.engine.dialect.name)
|
||||||
self.__dict__.pop("dialect_name", None)
|
self.__dict__.pop("dialect_name", None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user