Commit 3ab23bfc authored by Dustyn Gibson's avatar Dustyn Gibson
Browse files

Commit after massaction/action to reduce memory consumption 2-3k queries in...

Commit after massaction/action to reduce memory consumption 2-3k queries in memory?? and remove Locking. isolation level is non/deferred by default
parent 35ebfbab
......@@ -58,8 +58,6 @@ class DBConnection(object):
self.connection = sqlite3.connect(dbFilename(self.filename, self.suffix), 20, check_same_thread=False)
self.connection.text_factory = self._unicode_text_factory
self.connection.isolation_level = None
self.connection.cursor().execute('''PRAGMA locking_mode = EXCLUSIVE''')
db_cons[self.filename] = self.connection
else:
self.connection = db_cons[self.filename]
......@@ -108,7 +106,7 @@ class DBConnection(object):
def mass_action(self, querylist=[], logTransaction=False, fetchall=False):
# remove None types
querylist = [i for i in querylist if i is not None]
querylist = [i for i in querylist if i is not None and len(i)]
sqlResult = []
attempt = 0
......@@ -125,7 +123,7 @@ class DBConnection(object):
if logTransaction:
logger.log(qu[0] + " with args " + str(qu[1]), logger.DEBUG)
sqlResult.append(self.execute(qu[0], qu[1], fetchall=fetchall))
self.connection.commit()
logger.log(u"Transaction with " + str(len(querylist)) + u" queries executed", logger.DEBUG)
# finished
......@@ -168,6 +166,7 @@ class DBConnection(object):
logger.log(self.filename + ": " + query + " with args " + str(args), logger.DB)
sqlResult = self.execute(query, args, fetchall=fetchall, fetchone=fetchone)
self.connection.commit()
# get out of the connection attempt loop since we were successful
break
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment