mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-03-13 17:09:49 +00:00
completely solve 'NoneType' object is not iterable
This commit is contained in:
@@ -12,6 +12,7 @@ lock = threading.Lock()
|
||||
last_id = 0
|
||||
waiting_list = []
|
||||
finished_list = []
|
||||
last_exception = None
|
||||
|
||||
|
||||
class Task:
|
||||
@@ -21,9 +22,19 @@ class Task:
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
self.result = None
|
||||
self.exception = None
|
||||
|
||||
def work(self):
|
||||
self.result = self.func(*self.args, **self.kwargs)
|
||||
global last_exception
|
||||
self.exception = None
|
||||
last_exception = None
|
||||
try:
|
||||
self.result = self.func(*self.args, **self.kwargs)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
print(e)
|
||||
self.exception = e
|
||||
last_exception = e
|
||||
|
||||
|
||||
def loop():
|
||||
@@ -33,11 +44,9 @@ def loop():
|
||||
if len(waiting_list) > 0:
|
||||
with lock:
|
||||
task = waiting_list.pop(0)
|
||||
try:
|
||||
task.work()
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
print(e)
|
||||
|
||||
task.work()
|
||||
|
||||
with lock:
|
||||
finished_list.append(task)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user