Merge pull request #722 from hughsaunders/apt_retry_update
Retry apt cache updates
This commit is contained in:
commit
70c3aee12a
1 changed files with 9 additions and 1 deletions
|
@ -706,7 +706,15 @@ def main():
|
||||||
updated_cache_time = int(time.mktime(mtimestamp.timetuple()))
|
updated_cache_time = int(time.mktime(mtimestamp.timetuple()))
|
||||||
|
|
||||||
if cache_valid is not True:
|
if cache_valid is not True:
|
||||||
cache.update()
|
for retry in xrange(3):
|
||||||
|
try:
|
||||||
|
cache.update()
|
||||||
|
break
|
||||||
|
except apt.cache.FetchFailedException:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
#out of retries, pass on the exception
|
||||||
|
raise
|
||||||
cache.open(progress=None)
|
cache.open(progress=None)
|
||||||
updated_cache = True
|
updated_cache = True
|
||||||
updated_cache_time = int(time.mktime(now.timetuple()))
|
updated_cache_time = int(time.mktime(now.timetuple()))
|
||||||
|
|
Loading…
Reference in a new issue