Skip to content

Commit 73a087f

Browse files
authored
Merge pull request #668 from sinclairpaul/mysql-recycle
🔨 Add pool_recycle for MySQL
2 parents ed500ef + eabb10a commit 73a087f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spoolman/database/database.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,14 @@ def connect(self) -> None:
7979
connect_args = {}
8080
if self.connection_url.drivername == "sqlite+aiosqlite":
8181
connect_args["timeout"] = 60
82-
82+
connection_options = {}
83+
if self.connection_url.drivername == "mysql+aiomysql":
84+
connection_options["pool_recycle"] = 3600
8385
self.engine = create_async_engine(
8486
self.connection_url,
8587
connect_args=connect_args,
8688
pool_pre_ping=True,
89+
**connection_options,
8790
)
8891
self.session_maker = async_sessionmaker(self.engine, autocommit=False, autoflush=True, expire_on_commit=False)
8992

0 commit comments

Comments
 (0)