uniform listdir and use threadpool to index loras

This commit is contained in:
Vladimir Mandic
2024-01-06 15:15:23 -05:00
parent dd7e3e93c4
commit de80b74c64
20 changed files with 64 additions and 114 deletions
+6 -2
View File
@@ -7,6 +7,7 @@ from installer import setup_logging, args
preloaded = []
debug = os.environ.get('SD_SCRIPT_DEBUG', None)
def load_module(path):
@@ -20,9 +21,12 @@ def load_module(path):
if '/sd-extension-' in path: # safe extensions without stdout intercept
module_spec.loader.exec_module(module)
else:
# stdout = io.StringIO()
with contextlib.redirect_stdout(io.StringIO()) as stdout:
if debug:
module_spec.loader.exec_module(module)
stdout = io.StringIO()
else:
with contextlib.redirect_stdout(io.StringIO()) as stdout:
module_spec.loader.exec_module(module)
setup_logging() # reset since scripts can hijaack logging
for line in stdout.getvalue().splitlines():
if len(line) > 0: