diff --git a/plugos/manifest_cache.ts b/plugos/manifest_cache.ts index d287ff39..fa810b95 100644 --- a/plugos/manifest_cache.ts +++ b/plugos/manifest_cache.ts @@ -23,6 +23,7 @@ export class KVPrimitivesManifestCache implements ManifestCache { const manifest = plug.sandbox.manifest!; await this.kv.batchSet([{ key: [this.manifestPrefix, plug.name], + // Deliverately removing the assets from the manifest to preserve space, will be re-added upon load of actual worker value: { manifest: { ...manifest, assets: undefined }, hash }, }]); return manifest; @@ -43,7 +44,11 @@ export class InMemoryManifestCache implements ManifestCache { } await plug.sandbox.init(); const manifest = plug.sandbox.manifest!; - this.cache.set(plug.name!, { manifest, hash }); + // Deliverately removing the assets from the manifest to preserve space, will be re-added upon load of actual worker + this.cache.set(plug.name!, { + manifest: { ...manifest, assets: undefined }, + hash, + }); return manifest; } } diff --git a/plugos/sandbox.ts b/plugos/sandbox.ts index b73c3d23..95734806 100644 --- a/plugos/sandbox.ts +++ b/plugos/sandbox.ts @@ -32,8 +32,9 @@ export class Sandbox { init(): Promise { console.log("Booting up worker for", this.plug.name); if (this.worker) { - // Should not happen - console.warn("Double init of sandbox"); + // Race condition + console.warn("Double init of sandbox, ignoring"); + return Promise.resolve(); } this.worker = new Worker(this.plug.workerUrl, { ...this.workerOptions,