Suppress recurring 'still connecting' errors

Summary:
https://fb.workplace.com/groups/flippersupport/permalink/1304868459993809/

Changelog: Don't show errors for clients that fail to connect in a timely fashion repeatedly.

I think this change is fine, as even once the error is supressed, the clients will show up as 'still connecting...' in the app selector dropdown, which gives the same signal, but a bit less in the face.

Reviewed By: lawrencelomax

Differential Revision: D33976460

fbshipit-source-id: 7c5a02f3cd645ed1cbda47d186798857a05906f1
This commit is contained in:
Michel Weststrate
2022-02-04 01:19:07 -08:00
committed by Facebook GitHub Bot
parent 762267bccc
commit 4f9cec718e

View File

@@ -72,6 +72,7 @@ export class FlipperServerImpl implements FlipperServer {
ios?: IOSDeviceManager;
keytarManager: KeytarManager;
pluginManager: PluginManager;
unresponsiveClients: Set<string> = new Set();
constructor(
public config: FlipperServerConfig,
@@ -118,6 +119,9 @@ export class FlipperServerImpl implements FlipperServer {
medium: CertificateExchangeMedium;
deviceID: string;
}) => {
const clientIdentifier = `${client.deviceName}#${client.appName}`;
if (!this.unresponsiveClients.has(clientIdentifier)) {
this.unresponsiveClients.add(clientIdentifier);
this.emit('notification', {
type: 'error',
title: `Timed out establishing connection with "${client.appName}" on "${client.deviceName}".`,
@@ -126,6 +130,11 @@ export class FlipperServerImpl implements FlipperServer {
? `Verify that both your computer and mobile device are on Lighthouse/VPN that you are logged in to Facebook Intern so that certificates can be exhanged. See: https://fburl.com/flippervpn`
: 'Verify that your client is connected to Flipper and that there is no error related to idb or adb.',
});
} else {
console.warn(
`[conn] Client still unresponsive: "${client.appName}" on "${client.deviceName}"`,
);
}
},
);
}