Skip to content

Code Optimization and Issues Fixes in ComfyUI server#8196

Merged
comfyanonymous merged 2 commits intoComfy-Org:masterfrom
programming-pupil:master
May 21, 2025
Merged

Code Optimization and Issues Fixes in ComfyUI server#8196
comfyanonymous merged 2 commits intoComfy-Org:masterfrom
programming-pupil:master

Conversation

@programming-pupil
Copy link
Contributor

Description

This PR addresses two issues in the ComfyUI server code:

  1. Fixed parameter name in the get_embeddings route handler that would cause an unhandled exception
  2. Remove the redundant f.close() from the with open(...) as f: block

Changes

  1. Changed parameter name from self to request in the /embeddings route
  2. Remove the redundant f.close() from the with open(...) as f: block
    The with statement (context manager) is designed to ensure that resources (such as file handles) are properly freed at the end of a code block (e.g., by calling its exit method, which for file objects would normally call close()). So f.close() is not necessary in this case

Testing Done

Verified that:

  1. The /embeddings endpoint works correctly after the fix
  2. File resources are properly managed in image comparison operations
  3. No functionality has been broken by these changes

@comfyanonymous comfyanonymous merged commit 57893c8 into Comfy-Org:master May 21, 2025
5 checks passed
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.

2 participants