summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorNeil Johnson <neil@fragile.org.uk>2018-07-30 22:29:44 +0100
committerNeil Johnson <neil@fragile.org.uk>2018-07-30 22:29:44 +0100
commitfef7e58ac63d58f4a13f0914f51fc5956981af6a (patch)
tree3e388f964e4af5bec4dddd5ef11fcd7767d472d7 /synapse
parentmonthly_active_tests (diff)
downloadsynapse-fef7e58ac63d58f4a13f0914f51fc5956981af6a.tar.xz
actually close conn
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/__init__.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index 7b8215bf08..044e988e92 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -283,10 +283,14 @@ class DataStore(RoomMemberStore, RoomStore,
                 GROUP BY user_id
             ) u
         """
-        txn = self.db_conn.cursor()
-        txn.execute(sql, (thirty_days_ago,))
-        count, = txn.fetchone()
-        return count
+        try:
+            txn = self.db_conn.cursor()
+            txn.execute(sql, (thirty_days_ago,))
+            count, = txn.fetchone()
+            return count
+        finally:
+            txn.close()
+
 
 
     def count_r30_users(self):