fix(multiuser): keep queue badge & progress bar live across users#9313
Closed
lstein wants to merge 1 commit into
Closed
fix(multiuser): keep queue badge & progress bar live across users#9313lstein wants to merge 1 commit into
lstein wants to merge 1 commit into
Conversation
In multiuser mode, queue item status changes and batch-enqueued events are
emitted only to the owning user's socket room (for privacy). The frontend badge
and progress bar only refetch the global queue status in response to those
events, so a non-admin only learns about queue changes from their *own* jobs.
Once their jobs finish they get no further signal: the global total (the "/Y"
in "X/Y") and the in_progress count freeze, leaving the badge wrong and the
progress bar animating indefinitely.
Broadcast a content-free `queue_counts_changed` event to the whole queue room
whenever counts change (a status transition or an enqueue). It carries only the
queue_id — no user_id, batch_id, session_id, or counts — so every subscriber can
refetch GET /queue/{id}/status, which already redacts per-user data. Nothing
private is leaked, and it never fires on high-frequency invocation progress
events.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Superseded by #9314, which uses a branch hosted on invoke-ai/InvokeAI directly instead of my personal fork. Same commit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
In multiuser mode, a non-admin user's queue count badge (
X/Y) and the progress bar get stuck whenever another user has jobs in the queue.Reproduction
2/2(wrong — should be2/4); User B's shows2/4(correct).0/2and freezes with the progress bar animating indefinitely. User B counts down to0/4and clears cleanly.Root cause
queue_item_status_changedandbatch_enqueuedevents are emitted only to the owning user's socket room (correct, for privacy — they carry unsanitizeduser_id/batch_id/session_id). But the frontend badge and progress bar only refetch the global queue status in response to those events. So a non-admin only ever learns about queue changes from their own jobs. Once their jobs finish, they receive no further signal — the global total (the/Y) and thein_progresscount freeze.The queue order explains the exact symptoms: the user who queued first captured the global total before the second user's jobs existed; once their own jobs finished they stopped refetching. The stuck spinner is
ProgressBar.tsxreading a frozenin_progress > 0whilelastProgressEventis null.Fix
Broadcast a content-free
queue_counts_changedevent to the whole queue room whenever counts change (a status transition or an enqueue). It carries onlyqueue_id— nouser_id,batch_id,session_id, or counts — so every subscriber simply refetchesGET /queue/{id}/status, which already redacts per-user data. Nothing private is leaked. It fires only on status/enqueue events, never on high-frequency invocation-progress events.Changes
invokeai/app/api/sockets.py—_broadcast_queue_counts_changed()helper, called from the status-changed and batch-enqueued branches of_handle_queue_event.invokeai/frontend/web/src/services/events/types.ts— type the new event.invokeai/frontend/web/src/services/events/setEventListeners.tsx— handler invalidating onlySessionQueueStatus.Testing
2/4, count down together, and clear with no lingering spinner.tsc --noEmit,eslint --max-warnings=0,prettier --checkall pass.ruff checkandruff format --checkpass.🤖 Generated with Claude Code