Show possible remediation steps for known errors in a notification

Summary: This diff fires a notification with a remediation suggestion when the client takes a long time to connect back, for both WW and FS_ACCESS case

Reviewed By: mweststrate

Differential Revision: D23321067

fbshipit-source-id: 17ab93974e9571a0ba78af05c624eeb0522637c6
This commit is contained in:
Pritesh Nandgaonkar
2020-08-26 07:53:30 -07:00
committed by Facebook GitHub Bot
parent ce12c4e3df
commit dc4e224bfb
2 changed files with 38 additions and 2 deletions

View File

@@ -87,7 +87,7 @@ class Server extends EventEmitter {
logger: Logger;
store: Store;
initialisePromise: Promise<void> | null;
timeHandler: NodeJS.Timeout | undefined;
constructor(logger: Logger, store: Store) {
super();
this.logger = logger;
@@ -98,6 +98,7 @@ class Server extends EventEmitter {
this.insecureServer = null;
this.initialisePromise = null;
this.store = store;
this.timeHandler = undefined;
}
init() {
@@ -276,6 +277,9 @@ class Server extends EventEmitter {
if (!payload.data) {
return {};
}
if (this.timeHandler) {
clearTimeout(this.timeHandler);
}
const clientData: ClientQuery &
ClientCsrQuery & {medium: number | undefined} = JSON.parse(payload.data);
this.connectionTracker.logConnectionAttempt(clientData);
@@ -410,6 +414,16 @@ class Server extends EventEmitter {
}),
metadata: '',
});
this.timeHandler = setTimeout(() => {
// Fire notification
this.emit('client-unresponsive-error', {
client,
medium: transformCertificateExchangeMediumToType(medium),
deviceID: result.deviceId,
});
}, 30 * 1000);
this.emit('finish-client-setup', {
client,
deviceId: result.deviceId,