-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Refactor internal #889
Refactor internal #889
Conversation
…e necessary later (piping between routers of the same worker is not allowed anymore)
… `data` field instead of `internal`
…eries into maps, replace `.internal` with `.handlerId`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not completely reviewed, just some comments added. Another one here: shouldn't we add proper TS type to internal object received by JS instances such as Consumer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another one here: shouldn't we add proper TS type to internal object received by JS instances such as Consumer?
Potentially, but nothing has changed in that regard, internal
field in classes is the same as before, it just isn't sent in full to worker anymore. I think we can do that separately if you'd like.
Co-authored-by: Iñaki Baz Castillo <ibc@aliax.net>
Can this be merged so I'll adapt pending work of Jose in a new PR? |
prod.id 66d90c9f-3792-412c-b566-c861c7d0d1f7 error Error: Channel request handler with ID 66d90c9f-3792-412c-b566-c861c7d0d1f7 already exists [method:transport.produce]","time":"2022-10-15T13:51:02.831Z","v":0} I am getting this error constantly after these changes. Seems to happen once I subscribe "too fast", if I wait 5-10s, seems to work. (after I was told that it is available) Will provide more details.. |
@MatanYemini make sure to not pipe producers within the same worker to avoid that error. If you have further comments please create a thread on the forum: https://mediasoup.discourse.group/ |
The goal of this PR is to simplify things by replacing
internal
data structure that has several IDs, unique for different use cases, with onehandlerId
that can be looked up in a global map instead.In order to do that, every entity in the worker now implements
Channel::ChannelSocket::RequestHandler
if it handlesChannel
requests,PayloadChannel::PayloadChannelSocket::RequestHandler
if it handlesPayloadChannel
requests andPayloadChannel::PayloadChannelSocket::NotificationHandler
if it supports notifications. With that we can store them in 3 global maps and look up byhandleId
in one step instead of traversing down into nested structure.While this simplifies handling somewhat, it is even more beneficial for re-implementing #870 on top since we will no longer need to worry about a list of IDs that can belong to anything, we'll always have exactly one ID to deal with at a time.
Reviewing commits separately is recommended.