Skip to content

fix: respect capture_on_queue in WebcamCapture.IS_CHANGED#13338

Open
mango766 wants to merge 2 commits intoComfy-Org:masterfrom
mango766:fix/webcam-capture-on-queue
Open

fix: respect capture_on_queue in WebcamCapture.IS_CHANGED#13338
mango766 wants to merge 2 commits intoComfy-Org:masterfrom
mango766:fix/webcam-capture-on-queue

Conversation

@mango766
Copy link
Copy Markdown

@mango766 mango766 commented Apr 9, 2026

Fixes #13337

What's wrong

WebcamCapture has a capture_on_queue input (default True) that's supposed to force a new webcam capture every time a prompt is queued. But IS_CHANGED just delegates to the parent's file-hash check and never looks at the flag:

# before
@classmethod
def IS_CHANGED(cls, image, width, height, capture_on_queue):
    return super().IS_CHANGED(image)  # capture_on_queue silently ignored

Because IS_CHANGED returns the same SHA-256 hash when the on-disk image hasn't changed, ComfyUI's caching layer skips re-executing the node — so live webcam feeds appear to freeze even with capture_on_queue=True.

Fix

Return float("NaN") when capture_on_queue is True, which tells the scheduler the node is always dirty and must run again. Fall back to the hash comparison only when the flag is off.

# after
@classmethod
def IS_CHANGED(cls, image, width, height, capture_on_queue):
    if capture_on_queue:
        return float("NaN")
    return super().IS_CHANGED(image)

One-line change, no new dependencies.

easonysliu added 2 commits April 9, 2026 14:19
When capture_on_queue is True, the node should always re-execute on
each queue operation. Previously IS_CHANGED ignored this flag and always
returned the file hash, causing the node to be skipped if the cached
image hadn't changed on disk - defeating the purpose of the option.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0a1b9bc0-a5f7-4546-951c-d5abcc1d0f6e

📥 Commits

Reviewing files that changed from the base of the PR and between 2d861fb and 197dba5.

📒 Files selected for processing (2)
  • comfy_extras/nodes_webcam.py
  • server.py

📝 Walkthrough

Walkthrough

This pull request modifies two files with distinct purposes. In comfy_extras/nodes_webcam.py, the WebcamCapture.IS_CHANGED() method adds conditional logic to return float("NaN") when capture_on_queue is True, while preserving existing behavior when False. In server.py, the mask image upload handling is refactored to use a context manager for opening mask images, ensuring deterministic file handle closure during the image conversion process.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Changes to server.py (unclosed file handle fix) appear unrelated to issue #13337, which focuses solely on WebcamCapture.IS_CHANGED behavior. Remove the server.py mask image file-handle fix or create a separate PR, as it's outside the scope of the capture_on_queue issue.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the main change: fixing WebcamCapture.IS_CHANGED to respect the capture_on_queue flag.
Description check ✅ Passed The description is directly related to the changeset, explaining the bug, the fix, and providing before/after code examples.
Linked Issues check ✅ Passed The PR successfully implements the fix described in issue #13337: IS_CHANGED now returns float('NaN') when capture_on_queue is True, forcing re-execution.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebcamCapture ignores capture_on_queue flag in IS_CHANGED

1 participant