Queue Handler
Make ComfyUI Wait Before It Runs the Next Thing
- trigger
- any
- trigger
- any
ComfyUI decides what runs by walking backwards from the output nodes - it gathers every requirement up the tree and executes in dependency order. That's usually right, and sometimes it's wrong: you want to eyeball the keyframes before the expensive video pass burns twenty minutes, or you want the model loader to hold off until everything upstream has actually finished. Queue Handler (class QueueHandler) is the manual override - it parks execution of everything downstream of it until you say go.
The shape is dead simple: it takes a trigger (any type - usually the output of whatever you want to happen first) and a pause boolean, with an optional any pass-through. When pause is on, the node holds the whole downstream branch in place, sleeping in a loop until the workflow is interrupted or told to continue. When you're ready, you click the Continue button that appears on the node (a small frontend widget that hits the pack's /lhy_queuehandler/continue/<node_id> endpoint), and everything downstream proceeds. It returns both the trigger and any values so your data keeps flowing on both paths.
This is a real-world pattern, not a toy. People use it to gate model loading - one user on r/comfyui described wiring their image output into the trigger specifically so ComfyUI wouldn't load the video models "whenever it feels like it," letting it wait until the preceding generations were actually done and verified. That's the canonical use: give the graph a "checkpoint where a human looks at things" between a fast step and an expensive step.
The inputs that matter
trigger- the thing that must be produced before the gate opens. Wire the output of the upstream node you want to complete (your keyframe save, your preview).pause(boolean, default false) - the master switch. Leave it on while you want the gate held; flip it to false and everything just flows through.any(optional) - a pass-through value that rides alongside, if you need to carry something extra past the gate.
Outputs: trigger and any, mirroring the inputs so the downstream graph gets its data.
Where people get tripped up
First, pause is a widget value, so changing it mid-run only takes effect the next time the node executes - you can't unpause a currently-stuck run by flipping it; that's what the Continue button is for. Second, the gate blocks its downstream branch, not the whole graph - wire it correctly or you'll wonder why the rest of the workflow finished while one chunk sat frozen. And note it pauses by polling in a loop, so a held run will happily keep a queue slot busy until you release it; a long-forgotten pause is how people end up with a "workflow that never finishes" that's actually just waiting on a button.
Installing it
Part of lhaoyun6/ComfyUI-lhyNodes. Install via ComfyUI Manager by searching for lhyNodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/lihaoyun6/ComfyUI-lhyNodes.git
python -m pip install -r ComfyUI-lhyNodes/requirements.txt
Restart ComfyUI. The pack's shared requirements are ultralytics, opencv-python, numpy, and yarl; this node uses none of them and downloads nothing.
If you've ever sat through a wasted render because a workflow sequenced itself in the wrong order, this is the cheapest fix available. It's a pause button with a trigger, and sometimes that's all you need.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| trigger | * | — | |
| pause | BOOLEAN | false | — |
| anyopt | * | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| trigger | * | — |
| any | * | — |