Files
fls-eugene-ComfyUI_TextRand…/execution_delay.py
T
2026-07-17 00:31:36 +02:00

49 lines
1.7 KiB
Python

import time
class ExecutionDelayNode:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
# The data flowing through the chain (Any type placeholder '*')
"any_input": ("*", {"forceInput": True}),
# The number of seconds to sleep/throttle
"seconds_to_wait": (
"INT",
{"default": 5, "min": 0, "max": 3600, "step": 1},
),
# Visual label toggle to trace wait status in your terminal window
"print_to_console": (["enable", "disable"], {"default": "enable"}),
}
}
# By declaring '*' as the output type, ComfyUI dynamically copies
# the exact data type that entered the node (String, Latent, Image, etc.)
RETURN_TYPES = ("*",)
RETURN_NAMES = ("output_data",)
FUNCTION = "trigger_throttle_delay"
CATEGORY = "TextRandomizer/Utility"
def trigger_throttle_delay(self, any_input, seconds_to_wait, print_to_console):
if seconds_to_wait > 0:
if print_to_console == "enable":
cyan_start, yellow_start, color_reset = (
"\033[96m",
"\033[93m",
"\033[0m",
)
print(
f"{cyan_start}[⏳ Throttle]{color_reset} Sleeping for {yellow_start}{seconds_to_wait}{color_reset} seconds..."
)
# Freeze execution thread entirely
time.sleep(seconds_to_wait)
if print_to_console == "enable":
print(
f"{cyan_start}[⏳ Throttle]{color_reset} Resume signal sent down pipeline."
)
return (any_input,)