]> arthur.barton.de Git - bup.git/commitdiff
web: don't re-resolve item in listing
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 17 Jul 2020 19:42:16 +0000 (21:42 +0200)
committerRob Browning <rlb@defaultvalue.org>
Sun, 19 Jul 2020 20:13:15 +0000 (15:13 -0500)
We already have an item, we just need its metadata. There's no
need to re-resolve it. Somehow, resolving it again is also very
slow for large directories (perhaps re-reading metadata again
and again?), and this significantly speeds up things.

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

index d765463d854df9a5218273e0d53def45c0f47d8b..6ef2fe9578420418f90d2d078d7f309b69dc84c6 100755 (executable)
@@ -118,8 +118,7 @@ def _dir_contents(repo, resolution, show_hidden=False):
             parent_item = resolution[-2][1] if len(resolution) > 1 else dir_item
             yield display_info(b'..', parent_item, parent_item, b'..')
             continue
-        res = vfs.try_resolve(repo, name, parent=resolution, want_meta=False)
-        res_name, res_item = res[-1]
+        res_item = vfs.ensure_item_has_metadata(repo, item, include_size=True)
         yield display_info(name, item, res_item)