Retry file deletion on error

This commit is contained in:
shortcutme 2016-11-07 23:47:09 +01:00
parent 9765afc286
commit 2cdde7dd46

View file

@ -410,7 +410,13 @@ class SiteStorage(object):
for inner_path in files:
path = self.getPath(inner_path)
if os.path.isfile(path):
for retry in range(5):
try:
os.unlink(path)
break
except Exception, err:
self.log.error("Error removing %s: %s, try #%s" % (path, err, retry))
time.sleep(float(retry)/10)
self.onUpdated(inner_path, False)
self.log.debug("Deleting empty dirs...")
@ -429,4 +435,3 @@ class SiteStorage(object):
else:
self.log.debug("Site data directory deleted: %s..." % self.directory)
return True # All clean