Buffer backup upload progress events#165249
Merged
zweckj merged 10 commits intohome-assistant:devfrom Mar 11, 2026
Merged
Conversation
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
zweckj
commented
Mar 10, 2026
21 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds throttling for backup upload progress events to prevent flooding the WebSocket with messages during large backups targeting multiple agents. Additionally, the backup coordinator is updated to skip async_refresh() for upload progress events since the coordinator doesn't need to react to intermediate progress updates.
Changes:
- Buffer
UploadBackupEventinstances in the backup manager, sending the first event immediately and then flushing buffered events at most once per second (per agent, keeping only the latest) - Skip coordinator refresh for
UploadBackupEventinBackupDataUpdateCoordinator._on_event - Add three new tests covering throttling behavior, flush-on-state-change, and coordinator skip logic
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| homeassistant/components/backup/manager.py | Adds upload progress throttling: buffers UploadBackupEvents keyed by agent_id, flushes immediately on first event, then on a 1-second timer, and flushes all pending events before any non-upload event |
| homeassistant/components/backup/coordinator.py | Skips async_refresh() when the coordinator receives an UploadBackupEvent |
| tests/components/backup/test_manager.py | Adds tests for throttling, flush-on-state-change, and coordinator skip behavior |
zweckj
commented
Mar 11, 2026
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
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.
Breaking change
Proposed change
For the upload progress validation during backup buffer the progress events so we don't flood the websocket with messages for large backups with multiple different backup targets.
Additionally, don't let the coordinator refresh for progress events, it does not need to know about those state changes, only when the upload starts and completes.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: