Lazy initialize sandboxes (workers) upon first need

This commit is contained in:
Zef Hemel
2022-11-01 09:57:20 +01:00
parent a5b8fce3eb
commit 5d9329a531
6 changed files with 40 additions and 18 deletions
+2 -2
View File
@@ -138,13 +138,13 @@ export class HttpServer {
this.system.addHook(new EndpointHook(this.app, "/_"));
this.system.on({
plugLoaded: async (plug) => {
sandboxInitialized: async (sandbox) => {
for (
const [modName, code] of Object.entries(
this.globalModules.dependencies!,
)
) {
await plug.sandbox.loadDependency(modName, code as string);
await sandbox.loadDependency(modName, code as string);
}
},
});