From: Johannes Berg Date: Fri, 17 Jul 2020 19:42:16 +0000 (+0200) Subject: web: don't re-resolve item in listing X-Git-Tag: 0.31~25 X-Git-Url: https://arthur.barton.de/gitweb/?p=bup.git;a=commitdiff_plain;h=eadddb9ded212a4d6b9ec3f65532a7e6bb267bef web: don't re-resolve item in listing 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 Reviewed-by: Rob Browning Tested-by: Rob Browning --- diff --git a/lib/cmd/web-cmd.py b/lib/cmd/web-cmd.py index d765463..6ef2fe9 100755 --- a/lib/cmd/web-cmd.py +++ b/lib/cmd/web-cmd.py @@ -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)