Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand fonction broken by circular tree implementation #23

Open
dewiweb opened this issue Jul 28, 2022 · 7 comments
Open

Expand fonction broken by circular tree implementation #23

dewiweb opened this issue Jul 28, 2022 · 7 comments

Comments

@dewiweb
Copy link

dewiweb commented Jul 28, 2022

Hi, LAWO had introduced a new implementation of MC2 ember+ tree representation between release 5 and release 6 with references to parent and children. Now, when you want to expand nodes, js see them as circular object so you can't expand the whole tree. Expand fonction return a circular object you can't stringify.... So you can only view the first level of expansion.

@mint-dewit
Copy link

Hi, currently the library does not implement a stringify option. We had started this work initially but ran out of time unfortunately. See also #11

@dewiweb
Copy link
Author

dewiweb commented Jul 29, 2022

Ok! So, what's the interest of expand function?
I think there's also another problem:

Unhandled Exception UnhandledRejection Error: Request timed out
    at C:\Users\Administrateur\Documents\GitHub\MCxOSCnext\node_modules\emberplus-connection\dist\Ember\Client\index.js:525:32
    at Map.forEach (<anonymous>)
    at EmberClient._resendTimer (C:\Users\Administrateur\Documents\GitHub\MCxOSCnext\node_modules\emberplus-connection\dist\Ember\Client\index.js:512:28)   
    at Timeout._onTimeout (C:\Users\Administrateur\Documents\GitHub\MCxOSCnext\node_modules\emberplus-connection\dist\Ember\Client\index.js:47:46)
    at listOnTimeout (node:internal/timers:559:17)
    at process.processTimers (node:internal/timers:502:7)
11:41:38 / (node:4492) UnhandledPromiseRejectionWarning: UnhandledRejection Error: Request timed out
    at C:\Users\Administrateur\Documents\GitHub\MCxOSCnext\node_modules\emberplus-connection\dist\Ember\Client\index.js:525:32
    at Map.forEach (<anonymous>)
    at EmberClient._resendTimer (C:\Users\Administrateur\Documents\GitHub\MCxOSCnext\node_modules\emberplus-connection\dist\Ember\Client\index.js:512:28)   
    at Timeout._onTimeout (C:\Users\Administrateur\Documents\GitHub\MCxOSCnext\node_modules\emberplus-connection\dist\Ember\Client\index.js:47:46)
    at listOnTimeout (node:internal/timers:559:17)
    at process.processTimers (node:internal/timers:502:7)
(Use `electron --trace-warnings ...` to show where the warning was created)
11:41:38 / (node:4492) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

with this function:

async function expandtree(){
        const request = await eGet.getDirectory(eGet.tree)
        const allroot = await request.response
        const expanded = await eGet.expand(allroot)
        console.log("EXPANDED:",expanded)
      }
      expandtree()

ducumented in #21 . I use the same logic but issue is not resolved.

@mint-dewit
Copy link

The expand function creates a local copy of the ember+ tree that is kept in sync with the remote tree. I don't really see the point of it personally, just requires a lot of memory and unnecessary updates.

I will try to make some time to look at that timeout thing although we do not use the expand function ourselves anyway.

@dewiweb
Copy link
Author

dewiweb commented Jul 29, 2022

Ok, so apart use of emberplus viewer, How to discover paths of parameters I need to control?
My need is the ability to discover with emberplus-connection, paths of parameters I want to control... before use getElementByPath(). Is it possible?

@boristian
Copy link

The expand function creates a local copy of the ember+ tree that is kept in sync with the remote tree. I don't really see the point of it personally, just requires a lot of memory and unnecessary updates.

It depends on your use case. If you have provider with a stable tree and element numbering und you only need some specific parameters, it's fine not to expand.
But element numbers do not have to be stable necessarily. There might be situations where a numbered path to parameter might change between two connections of your consumer.
Since sofie-emberplus-connection has no method to get an element by identifier path (yet?) and the numbered paths might not be stable, i think a working expand function might be a good thing :)

@dewiweb
Copy link
Author

dewiweb commented Jul 29, 2022

Since sofie-emberplus-connection has no method to get an element by identifier path (yet?) and the numbered paths might not
be stable, i think a working expand function might be a good thing :)

You can use getElementByPath() with paths formatted like this :

"Devices.Channels.Inputs.Inputs   1.Fader.Fader Level"

It works!(If you already know identifier)

@boristian
Copy link

Yes, it works in the client. For the server it is not implemented.
Maybe i have some time to come up with a PR.

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

No branches or pull requests

3 participants