Skip to content

Commit

Permalink
feat: Load plugins concurrently
Browse files Browse the repository at this point in the history
  • Loading branch information
bajrangCoder committed Nov 23, 2024
1 parent 384be75 commit a9e4cd9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/loadPlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default async function loadPlugins() {
toast(strings["loading plugins"]);
}

// Load plugins sequentially to better handle errors
for (const pluginDir of plugins) {
// Load plugins concurrently
const loadPromises = plugins.map(async (pluginDir) => {
const pluginId = Url.basename(pluginDir.url);
try {
await loadPlugin(pluginId);
Expand All @@ -22,7 +22,8 @@ export default async function loadPlugins() {
toast(`Failed to load plugin: ${pluginId}`);
results.push(false);
}
}
});

await Promise.allSettled(loadPromises);
return results.filter(Boolean).length;
}

0 comments on commit a9e4cd9

Please sign in to comment.