fix: staging status & queue insanity #6871
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR reworks a few related queue-related issues I'd been struggling with:
Staging Area Status
The frontend had no way to check if there were pending canvas generations. I had tried to work around this by manually tracking queue items for canvas generations but it got really messy, and still didn't fix all of the problems. Notably, it was possible for the staging area to get stuck if you start a canvas generation and immediately cancel it.
In this PR, a new method is added to the queue & its router to get the queue item counts for a given destination. For example, we can use this to check if there are any in progress queue items for canvas, which tells us if we should be in staging mode or not. This small change opens a path to resolving the stuck staging area issue, and remove all the manual tracking nonsense.
Now, we know we should be staging if 1) we have images staged or 2) there is a pending/in-progress canvas generation.
This change also allows progress event handling in the frontend to be simplified quite a bit.
Progress Event Handling
The major change here is that the canvas classes now manage their own socket subscription and progress event tracking. The "global" progress event handling is also simplified.
(The "global" progress event handling is what drives the progress bar & progress images in the viewer, while the canvas-managed progress event handling drives the progress images that display on the canvas.)
Had to move some stuff around to fix circular imports.
Queue Controls UI
Queue Front
button (lightning bolt), you can hold shift while clicking invoke to use that feature now. This frees up some room in the queue controls area.Related Issues / Discussions
Some reports on discord, offline discussion
QA Instructions
Try to break the progress bar and progress images by queuing and canceling items in various ways and at different times. Should be bulletproof 🤞 both for send-to-canvas and send-to-gallery.
Merge Plan
I can do an alpha tomorrow morning
Checklist