-
Notifications
You must be signed in to change notification settings - Fork 131
Refactor local transport testing and local membership initialization #3576
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
base: livekit
Are you sure you want to change the base?
Conversation
f3633d2 to
1fd9ac9
Compare
BillCarsonFr
left a comment
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.
Great refactor 👍
Just a few comments
src/livekit/openIDSFU.ts
Outdated
| >; | ||
|
|
||
| /** | ||
| * |
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.
Suggestion?
Gets a bearer token from the homeserver and then use it to authenticate to the matrix RTC backend in order to get acces to the SFU.
It has built-in retry for calls to the homeserver with a backoff policy. Will bubble errors from the matrix RTC backend :(.
src/room/GroupCallErrorBoundary.tsx
Outdated
| }: ErrorPageProps): ReactElement => { | ||
| const { t } = useTranslation(); | ||
|
|
||
| logger.log("Error boundary caught:", error); |
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.
log.error?
| livekit_service_url: "http://my-oldest-member-service-url.com", | ||
| livekit_alias: "my-oldest-member-service-alias", | ||
| }; | ||
| // vi.mock("../../../widget", async (importOriginal) => ({ |
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.
nit: delete?
| /** | ||
| * Whether we are connected to the MatrixRTC session. | ||
| */ | ||
| export function createHomeserverConnected$( |
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.
I think we talked about extracting that to its own file? with some tests. Maybe next PR
| * @prop useOldestMember Whether to use the same transport as the oldest member. | ||
| * This will only update once the first oldest member appears. Will not recompute if the oldest member leaves. | ||
| * | ||
| * @throws MatrixRTCTransportMissingError | FailToGetOpenIdToken |
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.
👍 I wonder if we can have a linter rule that uses that information to ensure the caller handle the errors
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.
I searched a bit. not possible.
| transportFromStorage, | ||
| ); | ||
| return transportFromStorage; | ||
| transport = transportFromStorage; |
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.
Can we have a test for that? (checking that is trying local storage)
| }; | ||
| logger.log("Using LiveKit transport from config: ", transportFromConf); | ||
| return transportFromConf; | ||
| transport = transportFromConf; |
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.
is it also returning transport?
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.
this needed some update (the priority should have been the other way around) updated it.
| connectOptions$.value, | ||
| ); | ||
| }, | ||
| createPublisherFactory: (connection: Connection) => { |
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.
nit: maybe we can extract it as a const just before instead of inlining? WDYT
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.
This was consciously done inline to make clear that this is "one Package" of input and not entangled with the rest of the call view model.
So that its easier to understand why callviewmodel test just mock the while createLocalMembership$ return value.
BillCarsonFr
left a comment
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.
Ok for me 👍
| localTransportCanThrow$.pipe( | ||
| catchError((e: unknown) => { | ||
| let error: ElementCallError; | ||
| if (e instanceof ElementCallError) { |
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.
I think we have that at several place in the code, we might want some utility at some point
176c26c to
e60bc9e
Compare
A test in the callViewModel uncovered that there is a much better way to split test for the call setup.
This splits the test into localTransport tests that check for the different error cases and a test for the local Membership that checks that on error we will end up in the correct state for the callViewModel. (based on this state we set
fatalError$