fix: use unique client_id per ComfyUI WebSocket connection (#23592)
Using user.id as client_id causes WebSocket deadlocks when the same user generates images concurrently (e.g., multi-model chat). ComfyUI routes messages by clientId, so shared IDs mean only one connection receives the completion — others hang forever. Generate a unique UUID per request, matching ComfyUI's own examples.
This commit is contained in:
@@ -681,7 +681,7 @@ async def image_generations(
|
|||||||
res = await comfyui_create_image(
|
res = await comfyui_create_image(
|
||||||
model,
|
model,
|
||||||
form_data,
|
form_data,
|
||||||
user.id,
|
str(uuid.uuid4()),
|
||||||
request.app.state.config.COMFYUI_BASE_URL,
|
request.app.state.config.COMFYUI_BASE_URL,
|
||||||
request.app.state.config.COMFYUI_API_KEY,
|
request.app.state.config.COMFYUI_API_KEY,
|
||||||
)
|
)
|
||||||
@@ -1011,7 +1011,7 @@ async def image_edits(
|
|||||||
res = await comfyui_edit_image(
|
res = await comfyui_edit_image(
|
||||||
model,
|
model,
|
||||||
form_data,
|
form_data,
|
||||||
user.id,
|
str(uuid.uuid4()),
|
||||||
request.app.state.config.IMAGES_EDIT_COMFYUI_BASE_URL,
|
request.app.state.config.IMAGES_EDIT_COMFYUI_BASE_URL,
|
||||||
request.app.state.config.IMAGES_EDIT_COMFYUI_API_KEY,
|
request.app.state.config.IMAGES_EDIT_COMFYUI_API_KEY,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user