From: Mark Hymers Date: Sun, 9 Nov 2014 12:15:25 +0000 (+0000) Subject: Close our SQLAlchemy sessions X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=c25dc048881fdb6b2c7c8783dd1a49ba3cc90aeb;p=dak.git Close our SQLAlchemy sessions This is a temporary workaround to stop us leaving sessions around until I write a decorator function Signed-off-by: Mark Hymers --- diff --git a/dakweb/queries/archive.py b/dakweb/queries/archive.py index c694d3af..2ed4031e 100644 --- a/dakweb/queries/archive.py +++ b/dakweb/queries/archive.py @@ -24,6 +24,8 @@ def archives(): ret.append({'name': a.archive_name, 'suites': [x.suite_name for x in a.suites]}) + s.close() + return json.dumps(ret) QueryRegister().register_path('/archives', archives) diff --git a/dakweb/queries/source.py b/dakweb/queries/source.py index 39d8ea5c..a31b7b6d 100644 --- a/dakweb/queries/source.py +++ b/dakweb/queries/source.py @@ -35,6 +35,8 @@ def dsc_in_suite(suite=None, source=None): 'filesize': p.poolfile.filesize, 'sha256sum': p.poolfile.sha256sum}) + s.close() + return json.dumps(ret) QueryRegister().register_path('/dsc_in_suite', dsc_in_suite) diff --git a/dakweb/queries/suite.py b/dakweb/queries/suite.py index b5c0118c..245b879c 100644 --- a/dakweb/queries/suite.py +++ b/dakweb/queries/suite.py @@ -32,6 +32,8 @@ def suites(): 'architectures': [x.arch_string for x in p.architectures], 'components': [x.component_name for x in p.components]}) + s.close() + return json.dumps(ret) QueryRegister().register_path('/suites', suites) @@ -61,6 +63,7 @@ def suite(suite=None): if q.count() > 1: # This would mean dak is misconfigured + s.close() return bottle.HTTPError(503, 'Multiple suites found: configuration error') elif q.count() == 1: so = q[0] @@ -69,6 +72,7 @@ def suite(suite=None): q = s.query(Suite).filter(Suite.codename == suite) if q.count() > 1: # This would mean dak is misconfigured + s.close() return bottle.HTTPError(503, 'Multiple suites found: configuration error') elif q.count() == 1: so = q[0] @@ -81,6 +85,8 @@ def suite(suite=None): 'architectures': [x.arch_string for x in so.architectures], 'components': [x.component_name for x in so.components]} + s.close() + return json.dumps(so) QueryRegister().register_path('/suite', suite)