File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 33
44import nodes
55import asyncio
6+ import inspect
67from comfy_execution .graph_utils import is_link
78from comfy .comfy_types .node_typing import ComfyNodeABC , InputTypeDict , InputTypeOptions
89
@@ -239,8 +240,15 @@ def is_output(node_id):
239240 return True
240241 return False
241242
243+ # If an available node is async, do that first.
244+ # This will execute the asynchronous function earlier, reducing the overall time.
245+ def is_async (node_id ):
246+ class_type = self .dynprompt .get_node (node_id )["class_type" ]
247+ class_def = nodes .NODE_CLASS_MAPPINGS [class_type ]
248+ return inspect .iscoroutinefunction (getattr (class_def , class_def .FUNCTION ))
249+
242250 for node_id in node_list :
243- if is_output (node_id ):
251+ if is_output (node_id ) or is_async ( node_id ) :
244252 return node_id
245253
246254 #This should handle the VAEDecode -> preview case
You can’t perform that action at this time.
0 commit comments