From c69f33d1ea3e40efd1444e7faa40d1deb997a3e6 Mon Sep 17 00:00:00 2001 From: mherdeg Date: Sun, 17 Nov 2013 01:59:31 +0000 Subject: [PATCH] Persist successful uploads to disk immediately When uploading a large number of files (and fully expecting this process to die/fail before it finishes uploading all of them), it can be frustrating that the list of successfully uploaded files is stored only in an in-memory shelf object and is persisted only after an attempt to upload every file, in the call to self.uploaded.close(). This diff adds a call to self.uploaded.sync() on every logUpload(), which makes it much faster to fix in tangible form a copy of the fact that a file was uploaded successfully. --- uploadr/uploadr.py | 1 + 1 file changed, 1 insertion(+) diff --git a/uploadr/uploadr.py b/uploadr/uploadr.py index fb6146e..41c9166 100644 --- a/uploadr/uploadr.py +++ b/uploadr/uploadr.py @@ -382,6 +382,7 @@ def logUpload( self, photoID, imageName ): imageName = str( imageName ) self.uploaded[ imageName ] = photoID self.uploaded[ photoID ] = imageName + self.uploaded.sync() def build_request(self, theurl, fields, files, txheaders=None): """