feat: Round-robin session queue scheduling across users#127
Draft
feat: Round-robin session queue scheduling across users#127
Conversation
- Add SESSION_QUEUE_MODE type and session_queue_mode config field - Modify dequeue() to support round-robin ordering when multiuser mode is active, serving each user in turn based on last-served timestamp - Add tests for FIFO and round-robin dequeue behavior Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add round-robin generation sessions across users
feat: Round-robin session queue scheduling across users
Mar 10, 2026
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.
In multiuser mode, a single user could monopolize the queue by enqueueing large batches, forcing other users to wait indefinitely. This adds a
round_robinqueue mode that interleaves jobs across users so each gets a turn before any user gets a second slot.Changes
session_queue_mode("FIFO"|"round_robin", default"round_robin"): controls dequeue ordering. Configurable viainvokeai.yaml, env var (INVOKEAI_SESSION_QUEUE_MODE), or CLI.session_queue_modeis ignored whenmultiuser=False.dequeue()SQL: uses two CTEs —user_last_servedtracksMAX(started_at)per user;user_next_itemselects each user's best pending item (priority DESC, item_id ASC). Rows are ordered byCOALESCE(last_served_at, '1970-01-01') ASCso the least-recently-served user always goes next.QA Instructions
multiuser: trueininvokeai.yaml(defaultsession_queue_mode: round_robin).session_queue_mode: FIFOand confirm strict insertion-order is restored.multiuser: false— confirm FIFO is used regardless ofsession_queue_mode.Run the new unit tests:
Checklist
What's Newcopy (if doing a release after this PR)Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.