[PATCH 2/2] Commit ever 100 updateflags requests
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
From: Stewart Smith <stewart@willster.(none)>
Improves syncing large status changes by about a factor of 100
100 is arbitrary. Seems like an acceptable number to have to redo
if crash
---
offlineimap/folder/LocalStatus.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/offlineimap/folder/LocalStatus.py
b/offlineimap/folder/LocalStatus.py
index 90ad3c8..86738b0 100644
--- a/offlineimap/folder/LocalStatus.py
+++ b/offlineimap/folder/LocalStatus.py
@@ -41,6 +41,7 @@ class LocalStatusFolder(BaseFolder):
self.savelock = threading.Lock()
self.doautosave = 1
self.accountname = accountname
+ self.count = 0 # used for batching operations before commit
BaseFolder.__init__(self)
self.dbfilename = self.filename + '.sqlite'
@@ -184,7 +185,10 @@ class LocalStatusFolder(BaseFolder):
flags.sort()
flags = ''.join(flags)
self.cursor.execute('UPDATE status SET flags=? WHERE id=?',(flags,uid))
- self.autosave()
+ self.count = self.count + 1
+ if self.count == 100:
+ self.autosave()
+ self.count = 0
def deletemessage(self, uid):
if not self.uidexists(uid):
--
1.5.3.GIT
|
|