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

Feat/debug elt buffer in worker mode #1438

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

Florent-Bouisset
Copy link
Collaborator

This PR aims to add the segment inventory sink representation in the debug element of the RxPayer when it's working in worker mode.

image

@@ -47,6 +47,8 @@ import {
} from "./globals";
import sendMessage, { formatErrorForSender } from "./send_message";

let shouldMonitorSegmentStoreUpdates = false;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really satisfied about the place this flag is declared, but I'm not sure where to put it while keeping same behavior

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about another solution where it's the main thread who always request it (and decides of when to do it in some sort of interval)?

Kind of like a

-> ping
<- pong

system?

Though it also has its own drawbacks

parentElt.removeChild(debugWrapperElt);
});
}

renderDebugElement.__IS_USED = isUsed;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this solution but I didn't want to change the API for createDebugElement that return only a function for now.

In terms of logic it's working only if there is maximum 1 debug element at a time.

@@ -347,6 +381,89 @@ export default class SegmentSinksStore {
}
return true;
}

public toSerialized() {
const serializedSegmentSinksStore: SerializedSegmentSinksStore = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an idea but maybe it's not better:
Instead of having a complex serialization, why not a totally ad-hoc solution where we would send an already-processed representation of the buffer graph?

Kind of like how we do for logs (which are also post-processed into the same graph than the debug element when using RxPaired).

This could be easier to maintain in a way if done well.

@@ -182,6 +185,7 @@ export default class MultiThreadContentInitializer extends ContentInitializer {
},
{ clearSignal: this._initCanceller.signal, emitCurrentValue: true },
);
this.trackDebugElementChanges();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wouldn't work if the debug element is shown during the content's playback no? (which seems to be most of the time on Canal+'s main application)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's working if the debug element is shown during content playback because this method track a SharedReference that represent if the debug element is in use or not.

@peaBerberian
Copy link
Collaborator

peaBerberian commented May 13, 2024

when it's working in worker mode.

Just in case for users that might read that PR, by "worker mode" we mean here the "multithreading" mode which is available when the experimental MULTI_THREAD feature is enabled ("worker" here refers to the HTML WebWorker we instantiate to run logic in another thread).

For now we provide under that mode less information in the debug element that can be displayed when adding the optional DEBUG_ELEMENT feature and calling the createDebugElement RxPlayer method.
It sounds like a rare scenario but it isn't at all, most notably at Canal+, where the "multithreading" mode is relied on on many devices.

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.

None yet

2 participants