[Plugins] Start immediately after fetch (closes #54)
This commit is contained in:
parent
0f912c28e7
commit
f85fc4b00c
1 changed files with 3 additions and 5 deletions
|
@ -123,11 +123,9 @@ export async function initPlugins() {
|
||||||
await awaitSyncWrapper(plugins);
|
await awaitSyncWrapper(plugins);
|
||||||
const allIds = Object.keys(plugins);
|
const allIds = Object.keys(plugins);
|
||||||
|
|
||||||
// Wait for every plugin that is enabled and allowed to update to be fetched...
|
// Loop over any plugin that is enabled, update it if allowed, then start it.
|
||||||
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(async (pl) => (plugins[pl].update && await fetchPlugin(pl), await startPlugin(pl))));
|
||||||
// ...then start ALL enabled plugins, regardless of whether they are allowed to update.
|
// Wait for the above to finish, then update all disabled plugins that are allowed to.
|
||||||
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));
|
allIds.filter(pl => !plugins[pl].enabled && plugins[pl].update).forEach(pl => fetchPlugin(pl));
|
||||||
|
|
||||||
return stopAllPlugins;
|
return stopAllPlugins;
|
||||||
|
|
Loading…
Reference in a new issue