Browse Source

feat: windows_selector_event_loop_policy option is added

pull/365/head
dr.lt.data 10 months ago
parent
commit
8077765d47
  1. 2
      README.md
  2. 13
      __init__.py
  3. 30
      prestartup_script.py

2
README.md

@ -260,6 +260,8 @@ NODE_CLASS_MAPPINGS.update({
For the portable version, use `..\..\..\python_embeded\python.exe update-fix.py`.
* For cases where nodes like `PreviewTextNode` from `ComfyUI_Custom_Nodes_AlekPet` are only supported as front-end nodes, we currently do not provide missing nodes for them.
* Currently, `vid2vid` is not being updated, causing compatibility issues.
* If you encounter the error message `Overlapped Object has pending operation at deallocation on Comfyui Manager load` under Windows
* Edit `config.ini` file: add `windows_selector_event_loop_policy = False`
## TODO: Unconventional form of custom node list

13
__init__.py

@ -28,7 +28,7 @@ except:
print(f"[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.")
version = [2, 2, 5]
version = [2, 3]
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
print(f"### Loading: ComfyUI-Manager ({version_str})")
@ -172,6 +172,7 @@ def write_config():
'bypass_ssl': get_config()['bypass_ssl'],
'default_ui': get_config()['default_ui'],
'component_policy': get_config()['component_policy'],
"windows_selector_event_loop_policy": get_config()['windows_selector_event_loop_policy'],
}
with open(config_path, 'w') as configfile:
config.write(configfile)
@ -192,6 +193,7 @@ def read_config():
'bypass_ssl': default_conf['bypass_ssl'] if 'bypass_ssl' in default_conf else False,
'default_ui': default_conf['default_ui'] if 'default_ui' in default_conf else 'none',
'component_policy': default_conf['component_policy'] if 'component_policy' in default_conf else 'workflow',
"windows_selector_event_loop_policy": default_conf['windows_selector_event_loop_policy'] if 'windows_selector_event_loop_policy' in default_conf else False,
}
except Exception:
@ -203,7 +205,8 @@ def read_config():
'share_option': 'all',
'bypass_ssl': False,
'default_ui': 'none',
'component_policy': 'workflow'
'component_policy': 'workflow',
"windows_selector_event_loop_policy": False
}
@ -2332,9 +2335,15 @@ async def default_cache_update():
await asyncio.gather(a, b, c, d)
threading.Thread(target=lambda: asyncio.run(default_cache_update())).start()
if not os.path.exists(config_path):
get_config()
write_config()
WEB_DIRECTORY = "js"
NODE_CLASS_MAPPINGS = {}
__all__ = ['NODE_CLASS_MAPPINGS']

30
prestartup_script.py

@ -457,11 +457,27 @@ if os.path.exists(script_list_path):
del processed_install
del pip_list
if platform.system() == 'Windows':
def check_windows_event_loop_policy():
try:
import asyncio
import asyncio.windows_events
asyncio.set_event_loop_policy(asyncio.windows_events.WindowsSelectorEventLoopPolicy())
print(f"[ComfyUI-Manager] Windows event loop policy mode enabled")
except Exception as e:
print(f"[ComfyUI-Manager] WARN: Windows initialization fail: {e}")
import configparser
import ssl
config_path = os.path.join(os.path.dirname(__file__), "config.ini")
config = configparser.ConfigParser()
config.read(config_path)
default_conf = config['default']
if 'bypass_ssl' in default_conf and default_conf['windows_selector_event_loop_policy'].lower() == 'true':
try:
import asyncio
import asyncio.windows_events
asyncio.set_event_loop_policy(asyncio.windows_events.WindowsSelectorEventLoopPolicy())
print(f"[ComfyUI-Manager] Windows event loop policy mode enabled")
except Exception as e:
print(f"[ComfyUI-Manager] WARN: Windows initialization fail: {e}")
except Exception:
pass
if platform.system() == 'Windows':
check_windows_event_loop_policy()

Loading…
Cancel
Save