Skip to content

fix(viewer): pick up settings changed while the viewer starts or reconnects - #3541

Merged
vpetersson merged 1 commit into
masterfrom
fix/viewer-reload-at-startup
Nov 30, 2026
Merged

vpetersson merged 1 commit into
masterfrom
fix/viewer-reload-at-startup

Conversation

@vpetersson-bot

Copy link
Copy Markdown
Contributor

Issues Fixed

Settings changed right after the viewer (re)starts can be silently ignored. Found while testing touch support (internal tracker SIRI-2498).

Description

setup() loads the settings, then spends several seconds starting the webview, and only then does main() subscribe to the viewer channel. Redis pub/sub doesn't queue, so a reload published in that window is dropped, and the viewer runs on the old settings until something else triggers a reload. The same applies to anything published while the subscriber is reconnecting to Redis.

The fix:

  • ViewerSubscriber gets an on_subscribed hook, run after every successful subscribe (first start and every reconnect) and before it starts consuming. A failing hook is logged and doesn't stop the subscriber.
  • The viewer passes _catch_up_settings, which re-reads settings from disk and re-applies rotation and dark mode, the same as the settings part of _handle_reload.

So anything saved before the subscription is live gets picked up from disk, and anything after arrives as a reload.

Testing

  • Unit tests: catch-up runs after each (re)subscribe; a failing catch-up doesn't kill the subscriber; _catch_up_settings calls the right pieces. pytest -m "not integration": 3374 passed.
  • Reproduced and verified on the x86 rig board. Restart the viewer, enable debug_logging through the API right after the viewer logs Loading browser..., then count debug-level log lines 35 s later:
    • Stock master: 0. The setting is on disk, but the viewer never applied it.
    • With this fix: 197.

Checklist

  • I have performed a self-review of my own code.
  • New and existing unit tests pass locally and on CI with my changes.
  • I have done an end-to-end test for Raspberry Pi devices.
  • I have tested my changes for x86 devices.
  • I added a documentation for the changes I have made (when necessary).

🤖 Generated with Claude Code

…nnects

setup() loads settings, then spends seconds starting the webview before
main() subscribes to the viewer channel. A reload published in that
window, or while Redis is reconnecting, was dropped by pub/sub and the
viewer kept the old settings until the next change. ViewerSubscriber
now runs an on_subscribed hook after every successful subscribe, and
the viewer uses it to re-read settings (plus rotation and dark mode).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
@vpetersson-bot
vpetersson-bot requested a review from a team as a code owner November 30, 2026 21:15
@vpetersson-bot vpetersson-bot self-assigned this Nov 30, 2026
Copilot AI lite review requested due to automatic review settings November 30, 2026 21:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.

@sonarqubecloud

Copy link
Copy Markdown

@vpetersson
vpetersson merged commit 6aad93c into master Nov 30, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants