summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorTobias Hagelborn <tobias.hagelborn@axis.com>2024-02-23 14:27:31 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-23 14:34:05 +0000
commit42242fb9ef844fa2ac56eebd02ead921c57dde93 (patch)
treee31330a9ef5b0735367d506fa83ba1981d57e262 /bitbake
parenta226865c8683398b5f58628ba2ec5aee1ee6c19d (diff)
downloadpoky-42242fb9ef844fa2ac56eebd02ead921c57dde93.tar.gz
bitbake: hashserv: Re-enable connection pooling with psycopg 3 driver
Re-enable connection pooling in case `postgresql+psygopg` driver is used. Async connection pooling is supported in psycopg 3 [psycopg] driver in SQLAlchemy. Allow the connection pool to grow to arbitrary size. (Bitbake rev: 4fe05513b5314c201725e3f8ad54f58d70c56258) Signed-off-by: Tobias Hagelborn <tobiasha@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/hashserv/sqlalchemy.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bitbake/lib/hashserv/sqlalchemy.py b/bitbake/lib/hashserv/sqlalchemy.py
index fc3ae3d339..f7b0226a7a 100644
--- a/bitbake/lib/hashserv/sqlalchemy.py
+++ b/bitbake/lib/hashserv/sqlalchemy.py
@@ -129,7 +129,11 @@ class DatabaseEngine(object):
129 return inspect(conn).has_table(name) 129 return inspect(conn).has_table(name)
130 130
131 self.logger.info("Using database %s", self.url) 131 self.logger.info("Using database %s", self.url)
132 self.engine = create_async_engine(self.url, poolclass=NullPool) 132 if self.url.drivername == 'postgresql+psycopg':
133 # Psygopg 3 (psygopg) driver can handle async connection pooling
134 self.engine = create_async_engine(self.url, max_overflow=-1)
135 else:
136 self.engine = create_async_engine(self.url, poolclass=NullPool)
133 137
134 async with self.engine.begin() as conn: 138 async with self.engine.begin() as conn:
135 # Create tables 139 # Create tables