From ea36a943270b9e9890e884a96408382b0f35302c Mon Sep 17 00:00:00 2001 From: Paul Sinclair Date: Sat, 5 Apr 2025 09:58:34 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Add=20pool=5Frecycle=20for=20MyS?= =?UTF-8?q?QL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spoolman/database/database.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spoolman/database/database.py b/spoolman/database/database.py index e13fdf930..d3816db2f 100644 --- a/spoolman/database/database.py +++ b/spoolman/database/database.py @@ -79,11 +79,14 @@ def connect(self) -> None: connect_args = {} if self.connection_url.drivername == "sqlite+aiosqlite": connect_args["timeout"] = 60 - + connection_options = {} + if self.connection_url.drivername == "mysql+aiomysql": + connection_options["pool_recycle"] = 3600 self.engine = create_async_engine( self.connection_url, connect_args=connect_args, pool_pre_ping=True, + **connection_options, ) self.session_maker = async_sessionmaker(self.engine, autocommit=False, autoflush=True, expire_on_commit=False)