From 4f9cec718eb73103dddcdee8fcbe4305f0af7afb Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Fri, 4 Feb 2022 01:19:07 -0800 Subject: [PATCH] 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 --- .../src/FlipperServerImpl.tsx | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/desktop/flipper-server-core/src/FlipperServerImpl.tsx b/desktop/flipper-server-core/src/FlipperServerImpl.tsx index 226b97b40..43eccbcd8 100644 --- a/desktop/flipper-server-core/src/FlipperServerImpl.tsx +++ b/desktop/flipper-server-core/src/FlipperServerImpl.tsx @@ -72,6 +72,7 @@ export class FlipperServerImpl implements FlipperServer { ios?: IOSDeviceManager; keytarManager: KeytarManager; pluginManager: PluginManager; + unresponsiveClients: Set = new Set(); constructor( public config: FlipperServerConfig, @@ -118,14 +119,22 @@ export class FlipperServerImpl implements FlipperServer { medium: CertificateExchangeMedium; deviceID: string; }) => { - this.emit('notification', { - type: 'error', - title: `Timed out establishing connection with "${client.appName}" on "${client.deviceName}".`, - description: - medium === 'WWW' - ? `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.', - }); + 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}".`, + description: + medium === 'WWW' + ? `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}"`, + ); + } }, ); }