]> arthur.barton.de Git - bup.git/commitdiff
vfs: improve cache behaviour
authorJohannes Berg <johannes@sipsolutions.net>
Sun, 15 Mar 2020 21:38:15 +0000 (22:38 +0100)
committerRob Browning <rlb@defaultvalue.org>
Sun, 30 May 2021 16:55:07 +0000 (11:55 -0500)
If _commit_item_from_oid() is called first with require_meta=False,
and then again with require_meta=True, the second and further calls
will not use the cache, as the cached entry is without metadata.
Improve this by overwriting the cache entry if it couldn't be used.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/vfs.py

index eb737de54e5cd9117d9223e5df0922f3dc9c4ee1..9c8b9b4b0b05fceaab46ff28b4176f727768754f 100644 (file)
@@ -574,7 +574,7 @@ def _commit_item_from_oid(repo, oid, require_meta):
         if meta:
             commit = commit._replace(meta=meta)
     commit_key = b'itm:' + oid
-    cache_notice(commit_key, commit)
+    cache_notice(commit_key, commit, overwrite=True)
     return commit
 
 def _revlist_item_from_oid(repo, oid, require_meta):