Comfy-Org / Comfy-Org/ComfyUI_frontend
[Bug]: Queueing multiple items should use snapshot of current workflow
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
### Frontend Version
n/a;
refer to code reference below to current main branch.
ComfyUI: v0.3.14-11-g095d8671 (2025-02-09)
### Expected Behavior
After "Queue" is clicked, user changes to workflow should not affect items queued,
### Actual Behavior
After "Queue" is clicked, user changes to the workflow corrupt items being queued.
### Steps to Reproduce
* Get the server busy, for example, queue a hundred items
* Prepare a workflow
* Select for example "64" items to queue
* Click queue
* Quickly clear your CLIP text / prompt
* Wait
* Depending on how fast your server took the queued items, you will see that a fair number of items were queued with the cleared prompt, in other words, editing corrupts items being queued.
The problem is that the queue-method sends a request to the server before preparing the next request. When the server is busy, the user may already have started to edit the workflow to prepare for another render, which is then picked up by the queue-in-progress. The function should prepare all items to be queued while blocking the UI, and only then send them to the server one-by-one in the background.
Code reference:
https://github.com/Comfy-Org/ComfyUI_frontend/blob/96b84761f3a31b03ab33658ad0b6a593ce8c2728/src/scripts/app.ts#L1273-L1280
This should first loop over callbacks/queue prep, and then loop over queueing these items to the server.
Real-world example: I queued 1100 prompts which required minor text edits, each for 16 renders. So, edit text, submit, clear prompt, paste next prompt from text editor, edit, stir, repeat. After running the host for almost a day, a high proprtion of renders were garbage, and it wasn't noticable at the first 100+ because queuing is faster when fewer items are in the queue (or I was slow editing).
### Debug Logs
```powershell
n/a
```
### Browser Logs
n/a
### Setting JSON
n/a
### What browsers do you use to access the UI ?
Google Chrome
### Other Information
_No response_
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-2932-Bug-Queueing-multiple-items-should-use-snapshot-of-current-workflow-1b16d73d365081138247d33db8c88fd8) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.