🔀 Master Switch
The lazy switch that only computes the branch you need
- on_true
- on_false
- output
- log
A switch node in ComfyUI is easy to write and usually useless: both branches get computed anyway, so "switching" just picks one result after the work's already done. MasterSwitch is the version that actually saves you the work, because it's lazy. It asks ComfyUI not to execute the branch it isn't going to use - the same check_lazy_status trick that powers LazySessionCache, applied to a binary route.
In this pack it's the "is this the final cycle?" lever. The Loop Trigger sets its is_final_cycle input before each re-queue, and the Master Switch routes the graph accordingly: on intermediate cycles it feeds one branch (say, a cheap passthrough or a debug preview), and on the final cycle it switches to the expensive branch - the real audio router, the full assembly, whatever only the end needs. The node that isn't selected never runs.
How it works
is_final_cycle(BOOLEAN, defaultfalse) - the selector. In this pack it's driven automatically by the Loop Trigger, which rewrites this input in the prompt before re-queuing, so you never touch it manually during a loop.on_true(*, optional) - the value passed through whenis_final_cycleis true.on_false(*, optional) - passed through when false.
Outputs: output (*) - whatever branch won; log (STRING) - which branch fired.
The lazy hook returns ["on_true"] or ["on_false"], telling ComfyUI exactly which input to pull. The unselected branch's entire upstream chain is skipped - a heavy model or a big VAE pass on the losing side won't load at all. That's the feature. A normal switch evaluates both and discards one; this one evaluates one and doesn't look at the other.
How it's used here
The canonical pattern: Stitcher → Loop Trigger, and the Trigger mutates every MasterSwitch's is_final_cycle before re-queuing. The switch then chooses between, e.g., the ConditionalAudioRouter (which on intermediate cycles passes silence) and a direct audio path. The README lists it under "memory management / logic": it's how the pack amputates inactive routes so heavy nodes "aren't even loaded into memory" mid-loop.
The gotcha
Both branches must be present in the graph - if you leave on_true or on_false disconnected, the selected branch returns None and downstream nodes may choke. Decide before you wire whether every cycle needs a defined value on both sides. Also, because it's *-typed, ComfyUI can't type-check the branches for you; a type mismatch between on_true and on_false will surface downstream, not at this node. Check the log on the first run to confirm the branch you expected.
Install
ComfyUI Manager → search "comfyui-sequential-batcher", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Meisoftcoltd/comfyui-sequential-batcher
Restart ComfyUI. No models, no dependencies beyond the pack itself. House rule as always: launch without --highvram.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| is_final_cycle | BOOLEAN | false | — |
| on_trueopt | * | — | |
| on_falseopt | * | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| output | * | — |
| log | STRING | — |