From 7755f97ab2e73b5c53726f09a6a6c8d2d728744a Mon Sep 17 00:00:00 2001 From: Beef Date: Mon, 20 Feb 2023 18:58:07 +0000 Subject: [PATCH] [Plugins] Update disabled plugins --- src/lib/plugins.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/plugins.ts b/src/lib/plugins.ts index 34bd337..200701e 100644 --- a/src/lib/plugins.ts +++ b/src/lib/plugins.ts @@ -119,10 +119,14 @@ export function removePlugin(id: string) { export async function initPlugins() { await awaitSyncWrapper(plugins); - const allIds = Object.keys(plugins); - await Promise.allSettled(allIds.filter(pl => plugins[pl].enabled && plugins[pl].update).map((pl) => fetchPlugin(pl))); - await Promise.allSettled(allIds.filter(pl => plugins[pl].enabled).map((pl) => startPlugin(pl))); + + // Wait for every plugin that is enabled and allowed to update to be fetched... + await Promise.allSettled(allIds.filter(pl => plugins[pl].enabled && plugins[pl].update).map(pl => fetchPlugin(pl))); + // ...then start ALL enabled plugins, regardless of whether they are allowed to update. + await Promise.allSettled(allIds.filter(pl => plugins[pl].enabled).map(pl => startPlugin(pl))); + // After this, fetch all disabled plugins that are allowed to update, without waiting for them to finish doing so. + allIds.filter(pl => !plugins[pl].enabled && plugins[pl].update).forEach(pl => fetchPlugin(pl)); return stopAllPlugins; }