Skip to content

Feature: Add optional setting to prune queue on startup#8861

Merged
lstein merged 13 commits intoinvoke-ai:mainfrom
DustyShoe:Feat(Backend)/queue-prune-on-startup
Apr 14, 2026
Merged

Feature: Add optional setting to prune queue on startup#8861
lstein merged 13 commits intoinvoke-ai:mainfrom
DustyShoe:Feat(Backend)/queue-prune-on-startup

Conversation

@DustyShoe
Copy link
Copy Markdown
Collaborator

@DustyShoe DustyShoe commented Feb 7, 2026

Summary

This PR improves session queue cleanup by adding a configurable history limit instead of the previous all-or-nothing startup cleanup behavior.

  • Added max_queue_history config to keep the most recent N terminal session-queue items on startup (0 prunes all).
  • Startup logic now prunes terminal queue history based on max_queue_history.
  • Added a Max Queue History control to the Settings modal so the value can be configured in the UI as well as in invokeai.yaml.
  • Clarified config precedence and log output around queue cleanup.

Previously, the only available setting was clear_queue_on_startup, which cleared the entire session queue on startup.

This addition fixes slow startups caused by massive session-queue history buildup while allowing users to retain a configurable amount of recent queue history instead of choosing only between keeping everything or clearing everything.

Tip

To use the new option, add max_queue_history: <N> to invokeai.yaml, set INVOKEAI_MAX_QUEUE_HISTORY=<N>, or configure it in Settings > Generation.

Update

The setting can now be configured both in the UI and in invokeai.yaml.
UI changes are saved to invokeai.yaml, and manual YAML changes are shown in the UI after restart.

image image

QA Instructions

  1. Set max_queue_history in invokeai.yaml, for example:
    • max_queue_history: 5
  2. Ensure clear_queue_on_startup: false (or not set at all).
  3. Create enough terminal queue items to exceed the limit.
  4. Restart InvokeAI.
  5. Verify:
    • Only the most recent N terminal queue items remain after startup.
    • Logs include: Pruned X completed/failed/canceled queue items (kept up to N).
  6. Set max_queue_history: 0, restart, and verify terminal queue items are fully pruned on startup.
  7. Set clear_queue_on_startup: true, restart, and verify the entire session queue is cleared.

Merge Plan

Versioning/schema

  • No schema version bump is required; this is a new optional config setting.
  • No DB migration change.
  • Docs are generated from InvokeAIAppConfig, so the built docs will include max_queue_history without manual edits.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions Bot added python PRs that change python files services PRs that change app services labels Feb 7, 2026
@DustyShoe DustyShoe changed the title Feat(backend): queue prune on startup Feature(backend): Add optional setting to prune queue on startup Feb 7, 2026
@github-actions github-actions Bot added the frontend PRs that change frontend files label Feb 7, 2026
@lstein lstein assigned lstein and dunkeroni and unassigned lstein Feb 16, 2026
@DustyShoe DustyShoe changed the title Feature(backend): Add optional setting to prune queue on startup Feature: Add optional setting to prune queue on startup Feb 17, 2026
@lstein lstein added the v6.13.x label Feb 20, 2026
DustyShoe and others added 2 commits April 6, 2026 23:30
@github-actions github-actions Bot added the api label Apr 7, 2026
@lstein lstein enabled auto-merge (squash) April 14, 2026 00:04
@lstein lstein merged commit 9d62bfd into invoke-ai:main Apr 14, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api frontend PRs that change frontend files python PRs that change python files services PRs that change app services v6.13.x

Projects

Status: 6.13.x Theme: MODELS

Development

Successfully merging this pull request may close these issues.

3 participants