Skip to content

Commit 77c16d9

Browse files
gctuckerJenySadadia
authored andcommitted
kernelci.cli: show: skip unnecessary child nodes queries
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]>
1 parent a68f501 commit 77c16d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernelci/cli/show.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def _dump_results(self, api, node, indent=0, max_depth=0):
8080
line = self._color(line, 'underline')
8181
print(' '*indent, end='')
8282
print(line)
83-
child_nodes = api.get_nodes({'parent': node_id})
8483
if max_depth and indent == max_depth:
8584
return
85+
child_nodes = api.get_nodes({'parent': node_id})
8686
for child in child_nodes:
8787
self._dump_results(api, child, indent+1, max_depth)
8888

0 commit comments

Comments
 (0)