From 0a1793ab7f4757bd2a6ae84af557742b2131034a Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 13 Jan 2021 09:08:22 +0100 Subject: [PATCH] update: write out cache as soon as possible When working or testing with large APK collections, oftentimes it can take hours to scan all the APKs. If there is a failure before the apkcache is written out, then all that work is lost since no cache is written out. This moves the final cache writing before writing the index and knownapks to make it more likely that the apkcache is successfully written. --- fdroidserver/update.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index ef1310c7..de1948fa 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -2310,6 +2310,10 @@ def main(): # This will be done again (as part of apply_info_from_latest_apk) for repo and archive # separately later on, but it's fairly cheap anyway. read_names_from_apks(apps, apks + archapks) + + if cachechanged: + write_cache(apkcache) + # The added date currently comes from the oldest apk which might be in the archive. # So we need this populated at app level before continuing with only processing /repo # or /archive @@ -2349,9 +2353,6 @@ def main(): # Update known apks info... knownapks.writeifchanged() - if cachechanged: - write_cache(apkcache) - # Update the wiki... if options.wiki: logging.warning(_('wiki support is deprecated and will be removed in the next release!'))