Feature(backend): Add optional setting to prune queue on startup #8861
+67
−5
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 adds an optional setting in Invokeai.yaml:
max_queue_historyconfig to keep the most recent N terminal session-queue items on startup (0 prunes all).max_queue_history, while preserving pending/staged items.Previously, the only available setting was
clear_queue_on_startup, which wiped the entire session queue (including staged/pending items).This addition fixes slow startups caused by massive session-queue history buildup, while avoiding loss of staged/pending items.
Tip
To use the new option, add
max_queue_history: <N>toinvokeai.yaml(or setINVOKEAI_MAX_QUEUE_HISTORY=<N>).QA Instructions
QA Instructions (skip installation)
max_queue_historyininvokeai.yaml, e.g.:max_queue_history: 5clear_queue_on_startup: false.Pruned X completed/failed/canceled queue items (kept up to N).max_queue_history: 0, restart, and verify all terminal items are pruned while pending/staged items remain.clear_queue_on_startup: true, restart, and verify the entire session queue is cleared (including staged items).Merge Plan
Versioning/schema
Checklist
What's Newcopy (if doing a release after this PR)