From d19fcb19a808a95716becdede866ece948473fe8 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Thu, 6 Apr 2023 03:20:42 -0700 Subject: [PATCH] Don't die on timeout on fetching plugins Summary: The error below was uncaught, showing up in our error monitoring, however, since it is a transient problem (probably an app not responding, too slow in startup, paused in a debuggger, emu being slow, whatever, this isn't actionable from our side, so lowered to warning Reviewed By: lblasa Differential Revision: D44717738 fbshipit-source-id: aefd5e58b4953f563ed155f7a252c130aaafe7ab --- .../src/AbstractClient.tsx | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/desktop/flipper-frontend-core/src/AbstractClient.tsx b/desktop/flipper-frontend-core/src/AbstractClient.tsx index 0730a3bf1..fd0636a6f 100644 --- a/desktop/flipper-frontend-core/src/AbstractClient.tsx +++ b/desktop/flipper-frontend-core/src/AbstractClient.tsx @@ -126,17 +126,19 @@ export default abstract class AbstractClient extends EventEmitter { // get the supported plugins protected async loadPlugins(_phase: 'init' | 'refresh'): Promise { - const {plugins} = await timeout( - 30 * 1000, - this.rawCall<{plugins: Plugins}>('getPlugins', false), - 'Fetch plugin timeout', - ).catch((e) => { - console.warn('Fetch plugin timeout for ' + this.id); - throw e; - }); - this.plugins = new Set(plugins); - console.info('AbstractClient.loadPlugins', this.query, plugins); - return plugins; + let response; + try { + response = await timeout( + 30 * 1000, + this.rawCall<{plugins: Plugins}>('getPlugins', false), + 'Fetch plugin timeout. Unresponsive client?', + ); + } catch (e) { + console.warn('[conn] Fetch plugin error', e); + } + this.plugins = new Set(response?.plugins ?? []); + console.info('AbstractClient.loadPlugins', this.query, [...this.plugins]); + return this.plugins; } protected loadPlugin(