From df74c3c6385ddec225aaa630c77c95b9da0363b2 Mon Sep 17 00:00:00 2001 From: Haoming Date: Tue, 29 Oct 2024 14:12:42 +0800 Subject: [PATCH] threading --- modules/ui_extensions.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index 23aff7096..3f62e0518 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -106,7 +106,7 @@ 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) - for ext in exts: + def _check_update(ext): shared.state.textinfo = ext.name try: @@ -117,6 +117,14 @@ def check_updates(id_task, disable_list): except Exception: errors.report(f"Error checking updates for {ext.name}", exc_info=True) + 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() return extension_table(), ""