Created
August 19, 2023 11:04
-
-
Save NoCrypt/78151be43a8645f3266393602a7c2a61 to your computer and use it in GitHub Desktop.
Comfy faster extension load
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/web/scripts/app.js b/web/scripts/app.js | |
index 1c95c76..333080f 100644 | |
--- a/web/scripts/app.js | |
+++ b/web/scripts/app.js | |
@@ -1025,20 +1025,23 @@ export class ComfyApp { | |
}); | |
} | |
- /** | |
- * Loads all extensions from the API into the window | |
- */ | |
- async #loadExtensions() { | |
- const extensions = await api.getExtensions(); | |
- this.logging.addEntry("Comfy.App", "debug", { Extensions: extensions }); | |
- for (const ext of extensions) { | |
- try { | |
- await import(api.apiURL(ext)); | |
- } catch (error) { | |
- console.error("Error loading extension", ext, error); | |
- } | |
- } | |
- } | |
+ /** | |
+ * Loads all extensions from the API into the window in parallel | |
+ */ | |
+ async #loadExtensions() { | |
+ const extensions = await api.getExtensions(); | |
+ this.logging.addEntry("Comfy.App", "debug", { Extensions: extensions }); | |
+ | |
+ const extensionPromises = extensions.map(async ext => { | |
+ try { | |
+ await import(api.apiURL(ext)); | |
+ } catch (error) { | |
+ console.error("Error loading extension", ext, error); | |
+ } | |
+ }); | |
+ | |
+ await Promise.all(extensionPromises); | |
+ } | |
/** | |
* Set up the app on the page |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment