One suggestion: One 'safe' way of updating the same cached file with multiple
threads is to write the file under a random, temporary name and then rename it.
Rename operations should be atomic.
I would suggest the following change in httplib2/__init__.py
class FileCache(object):
...
def set(self, key, value):
cacheFullPath = os.path.join(self.cache, self.safe(key))
fd, fn = tempfile.mkstemp(dir=self.cache)
f = os.fdopen(fd, 'wb')
f.write(value)
f.close()
shutil.move(fn, cacheFullPath)
I attached the modified file.
Original issue reported on code.google.com by vgaro...@gmail.com on 7 Feb 2013 at 8:29
Original issue reported on code.google.com by
vgaro...@gmail.com
on 7 Feb 2013 at 8:29Attachments: