]> git.decadent.org.uk Git - dak.git/commitdiff
Close our SQLAlchemy sessions
authorMark Hymers <mhy@debian.org>
Sun, 9 Nov 2014 12:15:25 +0000 (12:15 +0000)
committerMark Hymers <mhy@debian.org>
Sun, 9 Nov 2014 12:15:25 +0000 (12:15 +0000)
This is a temporary workaround to stop us leaving sessions around
until I write a decorator function

Signed-off-by: Mark Hymers <mhy@debian.org>
dakweb/queries/archive.py
dakweb/queries/source.py
dakweb/queries/suite.py

index c694d3afbed5d02e9624fdf652e21f10275e1f9f..2ed4031eb233fdc1cec6ebb44eb9e43e3b315080 100644 (file)
@@ -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)
index 39d8ea5c5db80331ad7dc48ec0992f4ba20cd427..a31b7b6d0ccb0553c046b04a9fc7c8d325c006a9 100644 (file)
@@ -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)
index b5c0118c586ffc2d783eba7d1294f2927dedced9..245b879c8ea2c677f89f90d3e2b5922644f8aac1 100644 (file)
@@ -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)