Parallel plug loading on the server

This commit is contained in:
Zef Hemel
2022-10-21 17:06:14 +02:00
parent dc32ca81a9
commit 5bb73c111d
3 changed files with 6 additions and 10 deletions
+4 -7
View File
@@ -1,4 +1,4 @@
import { Application, etag, path, Router } from "./deps.ts";
import { Application, path, Router } from "./deps.ts";
import { Manifest, SilverBulletHooks } from "../common/manifest.ts";
import { loadMarkdownExtensions } from "../common/markdown_ext.ts";
import buildMarkdown from "../common/parser.ts";
@@ -175,13 +175,10 @@ export class HttpServer {
const allPlugs = await this.space.listPlugs();
console.log("Loading plugs", allPlugs);
for (const plugName of allPlugs) {
await Promise.all((await this.space.listPlugs()).map(async (plugName) => {
const { data } = await this.space.readAttachment(plugName, "string");
await this.system.load(
JSON.parse(data as string),
createSandbox,
);
}
await this.system.load(JSON.parse(data as string), createSandbox);
}));
this.rebuildMdExtensions();
const corePlug = this.system.loadedPlugs.get("core");