Skip to content

Commit

Permalink
kernelci.cli: show: skip unnecessary child nodes queries
Browse files Browse the repository at this point in the history
When using the --max-depth parameter, after a certain number of
recursion there is no need to look for any child nodes.  Move the call
to get the child nodes after the test that determines whether we've
reached that depth of recursion.

Signed-off-by: Guillaume Tucker <[email protected]>
  • Loading branch information
gctucker authored and JenySadadia committed Sep 14, 2023
1 parent a68f501 commit 77c16d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernelci/cli/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def _dump_results(self, api, node, indent=0, max_depth=0):
line = self._color(line, 'underline')
print(' '*indent, end='')
print(line)
child_nodes = api.get_nodes({'parent': node_id})
if max_depth and indent == max_depth:
return
child_nodes = api.get_nodes({'parent': node_id})
for child in child_nodes:
self._dump_results(api, child, indent+1, max_depth)

Expand Down

0 comments on commit 77c16d9

Please sign in to comment.