EasyUse will try to send_sync during module initialization, which is invalid. This tolerates such calls.

This commit is contained in:
Benjamin Berman 2025-10-28 17:32:06 -07:00
parent 7318e59baf
commit 05dd159136
3 changed files with 10 additions and 5 deletions

View File

@ -130,7 +130,7 @@ class ExecutorToClientProgress(Protocol):
last_prompt_id: Optional[str]
@property
def receive_all_progress_notifications(self):
def receive_all_progress_notifications(self) -> bool:
"""
Set to true if this should receive progress bar updates, in addition to the standard execution lifecycle messages
:return:

View File

@ -1,7 +1,7 @@
from __future__ import annotations
import uuid
from typing import Literal, Optional
from typing import Literal, Optional, Union
from ..component_model.executor_types import ExecutorToClientProgress, StatusMessage, ExecutingMessage
from ..component_model.queue_types import BinaryEventTypes
@ -25,7 +25,7 @@ class ServerStub(ExecutorToClientProgress):
def queue_updated(self, queue_remaining: Optional[int] = None):
pass
def send_progress_text(self, text: str, node_id: str = None):
def send_progress_text(self, text: Union[bytes, bytearray, str], node_id: str, sid=None):
pass
@property

View File

@ -1,11 +1,11 @@
from __future__ import annotations
import fnmatch
import importlib
import importlib.util
import logging
import os
import sys
import fnmatch
import time
import types
from contextlib import contextmanager
@ -18,6 +18,7 @@ from .comfyui_v3_package_imports import _comfy_entrypoint_upstream_v3_imports
from .package_typing import ExportedNodes
from ..cmd import folder_paths
from ..component_model.plugins import prompt_server_instance_routes
from ..distributed.server_stub import ServerStub
logger = logging.getLogger(__name__)
@ -43,8 +44,9 @@ class StreamToLogger:
pass
class _PromptServerStub:
class _PromptServerStub(ServerStub):
def __init__(self):
super().__init__()
self.routes = prompt_server_instance_routes
self.on_prompt_handlers = []
@ -52,6 +54,9 @@ class _PromptServerStub:
# todo: these need to be added to a real prompt server if the loading order is behaving in a complex way
self.on_prompt_handlers.append(handler)
def send_sync(self, *args, **kwargs):
logger.warning(f"Node tried to send a message over the websocket while importing, args={args} kwargs={kwargs}")
def _vanilla_load_importing_execute_prestartup_script(node_paths: Iterable[str]) -> None:
def execute_script(script_path):