mirror of
https://github.com/YunoHost/apps.git
synced 2024-09-03 20:06:07 +02:00
Smarter error reporting when failing to refresh cache
This commit is contained in:
parent
7a33f8af9a
commit
85fd0ce3fa
1 changed files with 13 additions and 5 deletions
|
@ -63,12 +63,12 @@ def refresh_all_caches():
|
|||
try:
|
||||
init_cache(app, infos)
|
||||
except Exception as e:
|
||||
error("Could not init cache for %s: %s" % (app, e))
|
||||
error("Failed to init cache for %s" % app)
|
||||
else:
|
||||
try:
|
||||
refresh_cache(app, infos)
|
||||
except Exception as e:
|
||||
error("Could not refresh cache for %s: %s" % (app, e))
|
||||
error("Failed to not refresh cache for %s" % app)
|
||||
|
||||
|
||||
def init_cache(app, infos):
|
||||
|
@ -90,9 +90,17 @@ def refresh_cache(app, infos):
|
|||
if os.path.exists(fetch_head) and now - os.path.getmtime(fetch_head) < 3600:
|
||||
return
|
||||
|
||||
git("remote set-url origin " + infos["url"], in_folder=app_cache_folder(app))
|
||||
git("fetch --quiet origin master --force", in_folder=app_cache_folder(app))
|
||||
git("reset origin/master --hard", in_folder=app_cache_folder(app))
|
||||
try:
|
||||
git("remote set-url origin " + infos["url"], in_folder=app_cache_folder(app))
|
||||
git("fetch --quiet origin master --force", in_folder=app_cache_folder(app))
|
||||
git("reset origin/master --hard", in_folder=app_cache_folder(app))
|
||||
except:
|
||||
# Sometimes there are tmp issue such that the refresh cache ..
|
||||
# we don't trigger an error unless the cache hasnt been updated since more than 24 hours
|
||||
if os.path.exists(fetch_head) and now - os.path.getmtime(fetch_head) < 24*3600:
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
################################
|
||||
|
|
Loading…
Add table
Reference in a new issue