Skip to content

Commit 5ce99e3

Browse files
authored
Merge pull request #4795 from barnabasdomozi/fix_unclosed_sess
Fix unclosed database session in add_product
2 parents 02194f0 + cfacb5c commit 5ce99e3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

web/server/codechecker_server/server.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,10 @@ def add_product(self, orm_product, init_db=False):
857857
# More on this:
858858
# https://github.com/Ericsson/codechecker/pull/3733#issuecomment-1235304179
859859
# https://github.com/PyCQA/pylint/issues/6005
860-
orm_product.num_of_runs = \
861-
prod.session_factory().query(func.count(Run.id)).one_or_none()[0] \
862-
# pylint: disable=not-callable
860+
with DBSession(prod.session_factory) as session:
861+
orm_product.num_of_runs = \
862+
session.query(func.count(Run.id)).one_or_none()[0] \
863+
# pylint: disable=not-callable
863864

864865
self.__products[prod.endpoint] = prod
865866

0 commit comments

Comments
 (0)