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

Fail to run two requests with the websocket API #3652

Closed
zhuofengli opened this issue Jun 5, 2024 · 2 comments
Closed

Fail to run two requests with the websocket API #3652

zhuofengli opened this issue Jun 5, 2024 · 2 comments
Labels
User Support A user needs help with something, probably not a bug.

Comments

@zhuofengli
Copy link

Hi there

When I send two requests to the API through websocket, only the latter one finishes, and the first one doesn't finish. Anyone else having the same issue?

I was following the API example in the code base, here's my code for sending the requests

def queue_prompt(prompt):
    p = {"prompt": prompt, "client_id": client_id}
    data = json.dumps(p).encode('utf-8')
    req =  urllib.request.Request("http://{}/prompt".format(server_address), data=data)
    return json.loads(urllib.request.urlopen(req).read())

By adding logging in the code I found the first request started executing, but was cut off by the second request.

@doctorpangloss

This comment was marked as spam.

@mcmonkey4eva mcmonkey4eva added the User Support A user needs help with something, probably not a bug. label Jun 10, 2024
@mcmonkey4eva
Copy link
Collaborator

Comfy API requests return a prompt_id value as seen here in the example script https://github.com/comfyanonymous/ComfyUI/blob/master/script_examples/websockets_api_example.py#L30
If you're only getting one of the two results, it's likely you're not properly tracking both prompt_ids independently properly

If you need more help with it you'll have to post all your code, or at least the relevant sections you changed rather than just the queue_prompt function from the example script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User Support A user needs help with something, probably not a bug.
Projects
None yet
Development

No branches or pull requests

3 participants