Retry file deletion on error
This commit is contained in:
parent
9765afc286
commit
2cdde7dd46
1 changed files with 7 additions and 2 deletions
|
@ -410,7 +410,13 @@ class SiteStorage(object):
|
||||||
for inner_path in files:
|
for inner_path in files:
|
||||||
path = self.getPath(inner_path)
|
path = self.getPath(inner_path)
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
|
for retry in range(5):
|
||||||
|
try:
|
||||||
os.unlink(path)
|
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.onUpdated(inner_path, False)
|
||||||
|
|
||||||
self.log.debug("Deleting empty dirs...")
|
self.log.debug("Deleting empty dirs...")
|
||||||
|
@ -429,4 +435,3 @@ class SiteStorage(object):
|
||||||
else:
|
else:
|
||||||
self.log.debug("Site data directory deleted: %s..." % self.directory)
|
self.log.debug("Site data directory deleted: %s..." % self.directory)
|
||||||
return True # All clean
|
return True # All clean
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue