Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, we walked the file tree as we recursed down, calling
iterdir()
,is_dir()
, andis_file()
on the way. For large workspacetrees, this was very slow.
Instead, we now get a list of all relative paths at the start,
and then walk down the paths, just processing them as strings, not
hitting disk. This is similar to how we built the tree for each
filegroup before, from a flat list of paths in the db. So that method
had been extracted as get_path_tree(), made more general, and is now
used by both get_workspace_files and get_request_files.
As we do not want to call
is_dir()
to detect directories, we insteaduse a heurstic based on the path.
This heuristic is not perfect - an empty directory with a
.
in thename will be misclassified as a file. However, this case seems very
rare, and I have added some protection in this case so we fail
gracefully.