summaryrefslogtreecommitdiff
path: root/src/cache.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2018-01-04 09:46:03 +0200
committerTimo Teräs <timo.teras@iki.fi>2018-01-04 10:56:09 +0200
commit8a28c6d0d4f81406c67e76b2bcdbe491aa734717 (patch)
tree148555889d66a69cdcd979ad77f1ba728b747f53 /src/cache.c
parent2da67940d50865d206f6a79165ce7b3de5a90de3 (diff)
downloadapk-tools-8a28c6d0d4f81406c67e76b2bcdbe491aa734717.tar.gz
apk-tools-8a28c6d0d4f81406c67e76b2bcdbe491aa734717.tar.bz2
apk-tools-8a28c6d0d4f81406c67e76b2bcdbe491aa734717.tar.xz
apk-tools-8a28c6d0d4f81406c67e76b2bcdbe491aa734717.zip
enable automatic update of indexes controlled by --cache-max-age
This modifies apk cache for indexes to be automatically refreshed periodically without explicit 'update' or '--update-cache' usage. The default is to do if-modified-since request if the local copy is older than 4 hours. This age can be changed with --cache-max-age. Using --update-cache will change this age to 60 seconds to make sure the cached copy is relatively new. The small age is in order to try to avoid downloading indexes second time when apk-tools is upgraded and apk re-execs after self-upgrade. Accordingly using explicitly 'apk update' will now enforce --force-refresh and request the very latest index by requesting any potential http proxy to do refresh too.
Diffstat (limited to 'src/cache.c')
-rw-r--r--src/cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cache.c b/src/cache.c
index f694085..aa43bdd 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -66,9 +66,9 @@ static int cache_download(struct apk_database *db)
if (repo == NULL)
continue;
- r = apk_cache_download(db, repo, pkg, APK_SIGN_VERIFY_IDENTITY,
+ r = apk_cache_download(db, repo, pkg, APK_SIGN_VERIFY_IDENTITY, 0,
progress_cb, &prog);
- if (r) {
+ if (r && r != -EALREADY) {
apk_error(PKG_VER_FMT ": %s", PKG_VER_PRINTF(pkg), apk_error_str(r));
ret++;
}