mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-03-14 09:28:12 +00:00
limit number of simultaneous updates
shared.opts.concurrent_git_fetch_limit
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import json
|
||||
import os
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
import threading
|
||||
import time
|
||||
from datetime import datetime, timezone
|
||||
@@ -106,26 +107,24 @@ def check_updates(id_task, disable_list):
|
||||
exts = [ext for ext in extensions.extensions if ext.remote is not None and ext.name not in disabled]
|
||||
shared.state.job_count = len(exts)
|
||||
|
||||
def _check_update(ext):
|
||||
shared.state.textinfo = ext.name
|
||||
lock = threading.Lock()
|
||||
|
||||
def _check_update(ext):
|
||||
try:
|
||||
ext.check_updates()
|
||||
except FileNotFoundError as e:
|
||||
if 'FETCH_HEAD' not in str(e):
|
||||
raise
|
||||
except Exception:
|
||||
errors.report(f"Error checking updates for {ext.name}", exc_info=True)
|
||||
with lock:
|
||||
errors.report(f"Error checking updates for {ext.name}", exc_info=True)
|
||||
with lock:
|
||||
shared.state.textinfo = ext.name
|
||||
shared.state.nextjob()
|
||||
|
||||
threads = []
|
||||
for ext in exts:
|
||||
thread = threading.Thread(target=_check_update, args=(ext,))
|
||||
thread.start()
|
||||
threads.append(thread)
|
||||
|
||||
for thread in threads:
|
||||
thread.join()
|
||||
shared.state.nextjob()
|
||||
with ThreadPoolExecutor(max_workers=max(1, int(shared.opts.concurrent_git_fetch_limit))) as executor:
|
||||
for ext in exts:
|
||||
executor.submit(_check_update, ext)
|
||||
|
||||
return extension_table(), ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user