From eadddb9ded212a4d6b9ec3f65532a7e6bb267bef Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 17 Jul 2020 21:42:16 +0200 Subject: [PATCH] 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 --- lib/cmd/web-cmd.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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) -- 2.39.2