ComfyUI Node

Wait xN

Hold the workflow until all your triggers have run

By lokinou·Created 11 months ago·Updated 8 months ago· 2
Wait xN
  • main
  • trigger1
  • main_output

ComfyUI's execution order is usually smart enough that you don't think about it - a node runs when its inputs are ready. But every now and then you have a stage that should wait on several things finishing, even though none of its own inputs depend on them. That's what Wait xN (class WaitMulti) is for: you wire the thing you actually want out into main, hang a bunch of trigger inputs off branches that need to finish first, and the node sits there until every trigger has executed - then passes main through.

The classic shape: you're parallelizing - a controlnet preprocess here, a second pass there - and the merge point needs all of them done. Or you want a downstream stage (a final save, a compare, a big decode) to wait for the whole batch to land rather than firing on the first branch that's ready.

How it works

The mechanism leans on ComfyUI's lazy evaluation. The node marks its trigger inputs as lazy + forceInput, and its check_lazy_status asks ComfyUI to evaluate any trigger that isn't computed yet - so a trigger branch only runs when the Wait node demands it, and only the branches that are actually connected get demanded. The forward function itself is a plain passthrough: whatever you put in main comes out of main_output. Nothing fancy, which is fine - the sequencing is the point, not the data.

The nice touch is the dynamic inputs. The node counts how many trigger inputs are currently connected (from the workflow JSON) and always exposes one more slot than is in use, so you just keep plugging in triggers and a new empty one appears. That's the "xN" in the name - no fixed three-trigger ceiling.

Inputs and outputs

  • main (required, any type) - the value you want passed through once the wait is over.
  • trigger1 (optional, any type, plus dynamically added trigger2, trigger3, …) - branches that must execute before main passes.
  • main_output (output, any type) - exactly main, delayed until all triggers fired.

Note the triggers are not forwarded - they gate the wait and are discarded. If you need the trigger values downstream, wire them separately.

Temper your expectations

The README is candid about this one: it's in the "experimental, not even tested" section, and the single-input Wait sibling is described as "deprioritized due to lazy loading." That's real honesty about the gap between "works in my head" and "works in every ComfyUI version." The lazy-input mechanics this relies on have shifted under authors before, so test it in your ComfyUI version before building a whole pipeline around it, and don't be surprised if an upstream update changes its behavior.

Install

It ships with lokinou/comfyui-better-flow - one install, seven nodes. Via ComfyUI Manager, search "comfyui-better-flow", or:

cd ComfyUI/custom_nodes
git clone https://github.com/lokinou/comfyui-better-flow.git

Restart ComfyUI fully so it registers. No pip dependencies, no model downloads.

The honest verdict

If you need a multi-trigger gate in a workflow you control, Wait xN does the job and its auto-growing inputs are genuinely nice. If you're trying to squeeze sequencing guarantees out of a shared workflow you don't control, treat it as a gamble - the pack itself flags it as untested, and that's exactly the warning you should heed.

Categorylnk/sequencing

Inputs (2)

NameTypeDefaultDescription
main*
trigger1opt*

Outputs (1)

NameTypeDescription
main_output*