Enhance requeue functions for ComfyUI version compatibility

Updated requeue_workflow_unchecked and requeue_workflow functions to handle both old and new ComfyUI versions with 5 and 6 value tuples.
This commit is contained in:
patientx
2025-11-25 01:15:40 +03:00
committed by GitHub
parent 8923bd836b
commit ae85dc37e6
+21 -4
View File
@@ -168,8 +168,14 @@ prompt_queue = server.PromptServer.instance.prompt_queue
def requeue_workflow_unchecked():
"""Requeues the current workflow without checking for multiple requeues"""
currently_running = prompt_queue.currently_running
(_, _, prompt, extra_data, outputs_to_execute) = next(iter(currently_running.values()))
value = next(iter(currently_running.values()))
# Handle both old (5 values) and new (6 values) ComfyUI versions
if len(value) == 6:
(_, prompt_id, prompt, extra_data, outputs_to_execute, _) = value
else:
(_, prompt_id, prompt, extra_data, outputs_to_execute) = value
#Ensure batch_managers are marked stale
prompt = prompt.copy()
for uid in prompt:
@@ -181,13 +187,24 @@ def requeue_workflow_unchecked():
number = -server.PromptServer.instance.number
server.PromptServer.instance.number += 1
prompt_id = str(server.uuid.uuid4())
prompt_queue.put((number, prompt_id, prompt, extra_data, outputs_to_execute))
# Put back with 6 elements to match what ComfyUI expects
sensitive = value[5] if len(value) > 5 else {}
prompt_queue.put((number, prompt_id, prompt, extra_data, outputs_to_execute, sensitive))
requeue_guard = [None, 0, 0, {}]
def requeue_workflow(requeue_required=(-1,True)):
assert(len(prompt_queue.currently_running) == 1)
global requeue_guard
(run_number, _, prompt, _, _) = next(iter(prompt_queue.currently_running.values()))
value = next(iter(prompt_queue.currently_running.values()))
# Handle both old (5 values) and new (6 values) ComfyUI versions
if len(value) == 6:
(run_number, _, prompt, extra_data, outputs_to_execute, _) = value
else:
(run_number, _, prompt, extra_data, outputs_to_execute) = value
if requeue_guard[0] != run_number:
#Calculate a count of how many outputs are managed by a batch manager
managed_outputs=0