aboutsummaryrefslogtreecommitdiff
path: root/src/Database.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-11-11 12:40:24 +0000
committerGravatar jesopo2018-11-11 12:40:24 +0000
commitc84205ed9b501b9709aa4620ed4ea91952557c20 (patch)
tree33c8068cea665b1e72986b6dfd0150408105cb9c /src/Database.py
parentMove channel tracking data/functions to src/IRCChannel.Channels (diff)
signature
Add a `threading.Lock()` around `cursor.execute(...)` in Database.py
Diffstat (limited to 'src/Database.py')
-rw-r--r--src/Database.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Database.py b/src/Database.py
index 1ed977de..28d86960 100644
--- a/src/Database.py
+++ b/src/Database.py
@@ -274,6 +274,7 @@ class Database(object):
check_same_thread=False, isolation_level=None)
self.database.execute("PRAGMA foreign_keys = ON")
self._cursor = None
+ self._lock = threading.Lock()
self.make_servers_table()
self.make_channels_table()
@@ -307,8 +308,8 @@ class Database(object):
start = time.monotonic()
cursor = self.cursor()
- cursor.execute(query, params)
- value = fetch_func(cursor)
+ with self._lock:
+ cursor.execute(query, params)
end = time.monotonic()
total_milliseconds = (end - start) * 1000