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
This commit is contained in:
Michel Weststrate
2023-04-06 03:20:42 -07:00
committed by Facebook GitHub Bot
parent cd7a6bfc40
commit d19fcb19a8

View File

@@ -126,17 +126,19 @@ export default abstract class AbstractClient extends EventEmitter {
// get the supported plugins
protected async loadPlugins(_phase: 'init' | 'refresh'): Promise<Plugins> {
const {plugins} = await timeout(
let response;
try {
response = 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;
'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(