comfyui-client icon indicating copy to clipboard operation
comfyui-client copied to clipboard

Improve: lazy polling

Open zhzLuke96 opened this issue 11 months ago • 0 comments

Currently, our polling logic is tied to the lifecycle of the example runner and runs continuously using setInterval.

In fact, this is unnecessary—because for a client, if it doesn't need to monitor ComfyUI's execution status, polling isn't required at all. It should only be activated when a task is being executed.

To implement this change, we need to build a Polling Manager that decouples the polling lifecycle from the polling request logic.

This will allow us to start and stop polling as needed, only when a client explicitly requires it.

https://github.com/StableCanvas/comfyui-client/blob/8e236f69cc95ad059d40407f97d5bdc31805f0a0/src/client/WsClient.ts#L250-L268

zhzLuke96 avatar May 29 '25 16:05 zhzLuke96