diff options
author | AUTOMATIC <16777216c@gmail.com> | 2023-05-15 17:57:11 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2023-05-15 17:57:11 +0000 |
commit | 0d2a4b608c075daa3a4d1a1c9df01a763ae4793a (patch) | |
tree | 25488d35aad44d0b99b9e5be18291e8ea71efe51 /modules/extensions.py | |
parent | 0d3a80e2692fb72da9798367b882f45312202f2e (diff) | |
download | stable-diffusion-webui-gfx803-0d2a4b608c075daa3a4d1a1c9df01a763ae4793a.tar.gz stable-diffusion-webui-gfx803-0d2a4b608c075daa3a4d1a1c9df01a763ae4793a.tar.bz2 stable-diffusion-webui-gfx803-0d2a4b608c075daa3a4d1a1c9df01a763ae4793a.zip |
load extensions' git metadata in parallel to loading the main program to save a ton of time during startup
Diffstat (limited to 'modules/extensions.py')
-rw-r--r-- | modules/extensions.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/extensions.py b/modules/extensions.py index bc2c0450..1053253e 100644 --- a/modules/extensions.py +++ b/modules/extensions.py @@ -1,5 +1,6 @@ import os
import sys
+import threading
import traceback
import time
@@ -24,6 +25,8 @@ def active(): class Extension:
+ lock = threading.Lock()
+
def __init__(self, name, path, enabled=True, is_builtin=False):
self.name = name
self.path = path
@@ -42,8 +45,13 @@ class Extension: if self.is_builtin or self.have_info_from_repo:
return
- self.have_info_from_repo = True
+ with self.lock:
+ if self.have_info_from_repo:
+ return
+ self.do_read_info_from_repo()
+
+ def do_read_info_from_repo(self):
repo = None
try:
if os.path.exists(os.path.join(self.path, ".git")):
@@ -70,6 +78,8 @@ class Extension: print(f"Failed reading extension data from Git repository ({self.name}): {ex}", file=sys.stderr)
self.remote = None
+ self.have_info_from_repo = True
+
def list_files(self, subdir, extension):
from modules import scripts
|