Skip to content

Conversation

@jaguarondi
Copy link

When en element of type Node has no childs, the root of the node is returned by getDirectoryAsync. This generates an infinite loop where the same function is called. By returning the element and not the root, this properly detects that there is no child and finishes that branch of the tree.

Here's the log displayed in a loop:

1763853435553 - DEBUG - EXPANDING_NODE Expanding node 1.2
1763853435553 - DEBUG - MAKING_REQUEST Making new request
1763853435553 - DEBUG - GETDIRECTORY_SENDING_QUERY Sending GetDirectory query 1.2
1763853435559 - DEBUG - EMBER_MESSAGE_RECEIVED Received Ember Message
1763853435559 - DEBUG - GETDIRECTORY_RESPONSE getDirectory response <ref *1> TreeNode {
  _parent: null,
  _subscribers: Set(0) {},
  elements: Map(1) {
    '1.2' => QualifiedNode {
      _parent: [Circular *1],
      _subscribers: Set(0) {},
      _path: '1.2',
      _seqID: 106,
      _contents: [NodeContents]
    }
  }
}

And here's what is returned with the change:

1763853592062 - DEBUG - EXPANDING_NODE Expanding node 1.2
1763853592062 - DEBUG - MAKING_REQUEST Making new request
1763853592062 - DEBUG - GETDIRECTORY_SENDING_QUERY Sending GetDirectory query 1.2
1763853592068 - DEBUG - EMBER_MESSAGE_RECEIVED Received Ember Message
1763853592068 - DEBUG - GETDIRECTORY_RESPONSE getDirectory response <ref *1> QualifiedNode {
  _parent: TreeNode {
    _parent: null,
    _subscribers: Set(0) {},
    elements: Map(1) { '1.2' => [Circular *1] }
  },
  _subscribers: Set(0) {},
  _path: '1.2',
  _seqID: 106,
  _contents: NodeContents { identifier: 'ios', description: '', isOnline: true }
}

I also attached the generated json. I only could get it with the fix as the json file is saved at the end and because of the loop, it never ends.

The fix is based on version3 branch.

fix_loop_when_nochild.json

When en element of type Node has no childs, the root of the node is
returned by getDirectoryAsync. This generates an infinite loop when the
same function is called. By returning the element and not the root, this
properly detects that there is no child and finishes that branch of the
tree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants