Use shared cursor where possible

This commit is contained in:
shortcutme 2019-03-18 03:36:44 +01:00
parent 61c72ac3ea
commit c88152cac2
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 8 additions and 2 deletions

View File

@ -181,6 +181,11 @@ class Db(object):
return cur
def getSharedCursor(self):
if not self.conn:
self.connect()
return self.cur
# Get the table version
# Return: Table version or None if not exist
def getTableVersion(self, table_name):
@ -201,7 +206,8 @@ class Db(object):
def checkTables(self):
s = time.time()
changed_tables = []
cur = self.getCursor()
cur = self.getSharedCursor()
# Check internal tables
# Check keyvalue table
@ -301,7 +307,7 @@ class Db(object):
# No cursor specificed
if not cur:
cur = self.getCursor()
cur = self.getSharedCursor()
cur.logging = False
# Row for current json file if required