Merge "Allow the pool_recycle to be configured" into feature/zuulv3
diff --git a/doc/source/admin/drivers/sql.rst b/doc/source/admin/drivers/sql.rst
index 34bb470..a269f5d 100644
--- a/doc/source/admin/drivers/sql.rst
+++ b/doc/source/admin/drivers/sql.rst
@@ -36,6 +36,13 @@
GRANT ALL ON my_database TO 'my_user'@'%';
+ .. attr:: pool_recycle
+ :default: 1
+
+ Tune the pool_recycle value. See `The SQLAlchemy manual on pooling
+ <http://docs.sqlalchemy.org/en/latest/core/pooling.html#setting-pool-recycle>`_
+ for more information.
+
Reporter Configuration
----------------------
diff --git a/zuul/driver/sql/sqlconnection.py b/zuul/driver/sql/sqlconnection.py
index f064864..b964c0b 100644
--- a/zuul/driver/sql/sqlconnection.py
+++ b/zuul/driver/sql/sqlconnection.py
@@ -44,11 +44,10 @@
# Recycle connections if they've been idle for more than 1 second.
# MySQL connections are lightweight and thus keeping long-lived
# connections around is not valuable.
- # TODO(mordred) Add a config paramter
self.engine = sa.create_engine(
self.dburi,
poolclass=sqlalchemy.pool.QueuePool,
- pool_recycle=1)
+ pool_recycle=self.connection_config.get('pool_recycle', 1))
self._migrate()
self._setup_tables()
self.zuul_buildset_table, self.zuul_build_table \