Skip to content

Commit 04903af

Browse files
authored
Merge pull request AUTOMATIC1111#16604 from Haoming02/ext-updt-parallel
Check for Extension Updates in Parallel
2 parents e8c3b1f + 9568622 commit 04903af

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

modules/shared_options.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
"disable_mmap_load_safetensors": OptionInfo(False, "Disable memmapping for loading .safetensors files.").info("fixes very slow loading speed in some cases"),
129129
"hide_ldm_prints": OptionInfo(True, "Prevent Stability-AI's ldm/sgm modules from printing noise to console."),
130130
"dump_stacks_on_signal": OptionInfo(False, "Print stack traces before exiting the program with ctrl+c."),
131+
"concurrent_git_fetch_limit": OptionInfo(16, "Number of simultaneous extension update checks ", gr.Slider, {"step": 1, "minimum": 1, "maximum": 100}).info("reduce extension update check time"),
131132
}))
132133

133134
options_templates.update(options_section(('profiler', "Profiler", "system"), {

modules/ui_extensions.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import os
3+
from concurrent.futures import ThreadPoolExecutor
34
import threading
45
import time
56
from datetime import datetime, timezone
@@ -106,18 +107,24 @@ def check_updates(id_task, disable_list):
106107
exts = [ext for ext in extensions.extensions if ext.remote is not None and ext.name not in disabled]
107108
shared.state.job_count = len(exts)
108109

109-
for ext in exts:
110-
shared.state.textinfo = ext.name
110+
lock = threading.Lock()
111111

112+
def _check_update(ext):
112113
try:
113114
ext.check_updates()
114115
except FileNotFoundError as e:
115116
if 'FETCH_HEAD' not in str(e):
116117
raise
117118
except Exception:
118-
errors.report(f"Error checking updates for {ext.name}", exc_info=True)
119-
120-
shared.state.nextjob()
119+
with lock:
120+
errors.report(f"Error checking updates for {ext.name}", exc_info=True)
121+
with lock:
122+
shared.state.textinfo = ext.name
123+
shared.state.nextjob()
124+
125+
with ThreadPoolExecutor(max_workers=max(1, int(shared.opts.concurrent_git_fetch_limit))) as executor:
126+
for ext in exts:
127+
executor.submit(_check_update, ext)
121128

122129
return extension_table(), ""
123130

0 commit comments

Comments
 (0)