Fix leak of SQLAlchemy engine objects in recorder (#121085)

This commit is contained in:
Erik Montnemery 2024-07-03 19:17:52 +02:00 committed by GitHub
parent 48172b0426
commit 61f1c8d963
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -960,6 +960,7 @@ class Recorder(threading.Thread):
tries += 1
if tries <= self.db_max_retries:
self._close_connection()
time.sleep(self.db_retry_wait)
return False
@ -1452,6 +1453,7 @@ class Recorder(threading.Thread):
if self._using_file_sqlite:
validate_or_move_away_sqlite_database(self.db_url)
assert not self.engine
self.engine = create_engine(self.db_url, **kwargs, future=True)
self._dialect_name = try_parse_enum(SupportedDialect, self.engine.dialect.name)
self.__dict__.pop("dialect_name", None)