Merge pull request #3679 from element-hq/toger5/fix-unnecassary-error-logs
Fix some error log lines that lead to confusion
This commit is contained in:
@@ -194,8 +194,8 @@ describe("LocalMembership", () => {
|
|||||||
matrixRTCMode: MatrixRTCMode.Matrix_2_0,
|
matrixRTCMode: MatrixRTCMode.Matrix_2_0,
|
||||||
}),
|
}),
|
||||||
matrixRTCSession: {
|
matrixRTCSession: {
|
||||||
updateCallIntent: () => {},
|
updateCallIntent: vi.fn().mockReturnValue(Promise.resolve()),
|
||||||
leaveRoomSession: () => {},
|
leaveRoomSession: vi.fn(),
|
||||||
} as unknown as MatrixRTCSession,
|
} as unknown as MatrixRTCSession,
|
||||||
muteStates: mockMuteStates(),
|
muteStates: mockMuteStates(),
|
||||||
trackProcessorState$: constant({
|
trackProcessorState$: constant({
|
||||||
@@ -244,6 +244,37 @@ describe("LocalMembership", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("logs if callIntent cannot be updated", async () => {
|
||||||
|
const scope = new ObservableScope();
|
||||||
|
|
||||||
|
const localTransport$ = new BehaviorSubject(aTransport);
|
||||||
|
const mockConnectionManager = {
|
||||||
|
transports$: constant(new Epoch([])),
|
||||||
|
connectionManagerData$: constant(new Epoch(new ConnectionManagerData())),
|
||||||
|
};
|
||||||
|
async function reject(): Promise<void> {
|
||||||
|
return Promise.reject(new Error("Not connected yet"));
|
||||||
|
}
|
||||||
|
const localMembership = createLocalMembership$({
|
||||||
|
scope,
|
||||||
|
...defaultCreateLocalMemberValues,
|
||||||
|
matrixRTCSession: {
|
||||||
|
updateCallIntent: vi.fn().mockImplementation(reject),
|
||||||
|
leaveRoomSession: vi.fn(),
|
||||||
|
},
|
||||||
|
connectionManager: mockConnectionManager,
|
||||||
|
localTransport$,
|
||||||
|
});
|
||||||
|
const expextedLog =
|
||||||
|
"'not connected yet' while updating the call intent (this is expected on startup)";
|
||||||
|
const internalLogger = vi.spyOn(localMembership.internalLoggerRef, "debug");
|
||||||
|
|
||||||
|
await flushPromises();
|
||||||
|
defaultCreateLocalMemberValues.muteStates.video.setEnabled$.value?.(true);
|
||||||
|
expect(internalLogger).toHaveBeenCalledWith(expextedLog);
|
||||||
|
scope.end();
|
||||||
|
});
|
||||||
|
|
||||||
const aTransport = {
|
const aTransport = {
|
||||||
transport: {
|
transport: {
|
||||||
livekit_service_url: "a",
|
livekit_service_url: "a",
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ export const createLocalMembership$ = ({
|
|||||||
* Fully connected
|
* Fully connected
|
||||||
*/
|
*/
|
||||||
connected$: Behavior<boolean>;
|
connected$: Behavior<boolean>;
|
||||||
|
internalLoggerRef: Logger;
|
||||||
} => {
|
} => {
|
||||||
const logger = parentLogger.getChild("[LocalMembership]");
|
const logger = parentLogger.getChild("[LocalMembership]");
|
||||||
logger.debug(`Creating local membership..`);
|
logger.debug(`Creating local membership..`);
|
||||||
@@ -524,12 +525,19 @@ export const createLocalMembership$ = ({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
combineLatest([muteStates.video.enabled$, homeserverConnected.combined$])
|
muteStates.video.enabled$.pipe(scope.bind()).subscribe((videoEnabled) => {
|
||||||
.pipe(scope.bind())
|
void matrixRTCSession
|
||||||
.subscribe(([videoEnabled, connected]) => {
|
.updateCallIntent(videoEnabled ? "video" : "audio")
|
||||||
if (!connected) return;
|
.catch((e) => {
|
||||||
void matrixRTCSession.updateCallIntent(videoEnabled ? "video" : "audio");
|
if (e instanceof Error && e.message === "Not connected yet") {
|
||||||
});
|
logger.debug(
|
||||||
|
"'not connected yet' while updating the call intent (this is expected on startup)",
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Keep matrix rtc session in sync with localTransport$, connectRequested$
|
// Keep matrix rtc session in sync with localTransport$, connectRequested$
|
||||||
scope.reconcile(
|
scope.reconcile(
|
||||||
@@ -673,6 +681,7 @@ export const createLocalMembership$ = ({
|
|||||||
sharingScreen$,
|
sharingScreen$,
|
||||||
toggleScreenSharing,
|
toggleScreenSharing,
|
||||||
connection$: localConnection$,
|
connection$: localConnection$,
|
||||||
|
internalLoggerRef: logger,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -352,17 +352,22 @@ async function makeTransport(
|
|||||||
// MSC4143: Attempt to fetch transports from backend.
|
// MSC4143: Attempt to fetch transports from backend.
|
||||||
if ("_unstable_getRTCTransports" in client) {
|
if ("_unstable_getRTCTransports" in client) {
|
||||||
try {
|
try {
|
||||||
const selectedTransport = await getFirstUsableTransport(
|
const transportList = await client._unstable_getRTCTransports();
|
||||||
await client._unstable_getRTCTransports(),
|
const selectedTransport = await getFirstUsableTransport(transportList);
|
||||||
);
|
|
||||||
if (selectedTransport) {
|
if (selectedTransport) {
|
||||||
logger.info("Using backend-configured SFU", selectedTransport);
|
logger.info(
|
||||||
|
"Using backend-configured (client.getRTCTransports) SFU",
|
||||||
|
selectedTransport,
|
||||||
|
);
|
||||||
return selectedTransport;
|
return selectedTransport;
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (ex instanceof MatrixError && ex.httpStatus === 404) {
|
if (ex instanceof MatrixError && ex.httpStatus === 404) {
|
||||||
// Expected, this is an unstable endpoint and it's not required.
|
// Expected, this is an unstable endpoint and it's not required.
|
||||||
logger.debug("Backend does not provide any RTC transports", ex);
|
// There will be expected 404 errors in the console. When we check if synapse supports the endpoint.
|
||||||
|
logger.debug(
|
||||||
|
"Matrix homeserver does not provide any RTC transports via `/rtc/transports` (will retry with well-known.)",
|
||||||
|
);
|
||||||
} else if (ex instanceof FailToGetOpenIdToken) {
|
} else if (ex instanceof FailToGetOpenIdToken) {
|
||||||
throw ex;
|
throw ex;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ interface SpotlightItemBaseProps {
|
|||||||
mxcAvatarUrl: string | undefined;
|
mxcAvatarUrl: string | undefined;
|
||||||
focusable: boolean;
|
focusable: boolean;
|
||||||
"aria-hidden"?: boolean;
|
"aria-hidden"?: boolean;
|
||||||
localParticipant: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SpotlightUserMediaItemBaseProps extends SpotlightItemBaseProps {
|
interface SpotlightUserMediaItemBaseProps extends SpotlightItemBaseProps {
|
||||||
@@ -188,7 +187,6 @@ const SpotlightItem: FC<SpotlightItemProps> = ({
|
|||||||
focusable,
|
focusable,
|
||||||
encryptionStatus,
|
encryptionStatus,
|
||||||
"aria-hidden": ariaHidden,
|
"aria-hidden": ariaHidden,
|
||||||
localParticipant: vm.local,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return vm instanceof ScreenShareViewModel ? (
|
return vm instanceof ScreenShareViewModel ? (
|
||||||
|
|||||||
@@ -460,7 +460,9 @@ export class MockRTCSession extends TypedEventEmitter<
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateCallIntent = vitest.fn();
|
public updateCallIntent = vitest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(async () => Promise.resolve());
|
||||||
|
|
||||||
private _membershipStatus = Status.Connected;
|
private _membershipStatus = Status.Connected;
|
||||||
public get membershipStatus(): Status {
|
public get membershipStatus(): Status {
|
||||||
|
|||||||
Reference in New Issue
Block a user