SQLite: make postponing transaction committing possible.
This should significantly improve performance when used to write large amounts of messages. This feature is enabled through the fsync configuration option. Code refactorize around fsync. This addresses #390 (although it doesn't necessarily fix all instances of that problem yet). Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/390 Originally-written-by: Giel van Schijndel <me@mortis.eu> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
		 Giel van Schijndel
					Giel van Schijndel
				
			
				
					committed by
					
						 Nicolas Sebrecht
						Nicolas Sebrecht
					
				
			
			
				
	
			
			
			 Nicolas Sebrecht
						Nicolas Sebrecht
					
				
			
						parent
						
							41c9694488
						
					
				
				
					commit
					b6ede627a9
				
			| @@ -60,7 +60,6 @@ class MaildirFolder(BaseFolder): | ||||
|     def __init__(self, root, name, sep, repository): | ||||
|         self.sep = sep # needs to be set before super().__init__ | ||||
|         super(MaildirFolder, self).__init__(name, repository) | ||||
|         self.dofsync = self.config.getdefaultboolean("general", "fsync", True) | ||||
|         self.root = root | ||||
|         # check if we should use a different infosep to support Win file systems | ||||
|         self.wincompatible = self.config.getdefaultboolean( | ||||
| @@ -330,7 +329,7 @@ class MaildirFolder(BaseFolder): | ||||
|         fd.write(content) | ||||
|         # Make sure the data hits the disk. | ||||
|         fd.flush() | ||||
|         if self.dofsync: | ||||
|         if self.dofsync(): | ||||
|             os.fsync(fd) | ||||
|         fd.close() | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user