Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke (websocket) doesn't support multiple returns #13

Open
jelling opened this issue Aug 29, 2024 · 2 comments
Open

Invoke (websocket) doesn't support multiple returns #13

jelling opened this issue Aug 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jelling
Copy link
Contributor

jelling commented Aug 29, 2024

When using the web-socket client, the first node that returns an output (message type = executed) terminates the connection:

this.client.on("executed", (data) => {
if (data.prompt_id !== task_id) {
return;
}
this.resolve_to_result(data);
this.executed = true;
resolve(this._result);
done();
}),

But looking at the Comfy UI message types, there wasn't an obvious message to listen for show that all nodes have completed other than perhaps watching the queue count on the status message.

The immediate workaround is to just use the invoke_polling method, which works fine for my purposes. But thought I'd get your thoughts before trying to fix it in my fork.

@zhzLuke96
Copy link
Member

thx feedback.

I just tested it and found that the main-wf-loop.ts example code triggers this issue (if using ETN_SendImageWebSocket). It seems I had probably encountered this before but didn't pinpoint the cause at the time 😂

If we want to fix this, I estimate it should be quite simple. We can check the task status each time we detect an "executed" state from a task, instead of immediately considering the workflow as completed.

You're right, there's no direct interface to query the task status. So I've wrapped a function on the client class to do this: client.getPromptStatus(prompt_id).

Would you like to submit a PR? If you've attempted a fix, feel free to share your results.

@zhzLuke96 zhzLuke96 added the bug Something isn't working label Aug 30, 2024
zhzLuke96 added a commit that referenced this issue Aug 30, 2024
- Fix missing non-websocket output
- Fix lifecycle
- Add `wait_polling`
- Refactor InvokedWorkflow
- up to 1.3.16
@zhzLuke96
Copy link
Member

Fixed 8a7dc42

I discovered another issue, so I fixed it together. You can try it out, and if there are still problems, we can continue discussing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants