Skip to content

fix: drop hub control commands that waited too long to send - #393

Merged
hhvrc merged 1 commit into
developfrom
fix/drop-delayed-commands
Nov 13, 2026
Merged

hhvrc merged 1 commit into
developfrom
fix/drop-delayed-commands

Conversation

@hhvrc

@hhvrc hhvrc commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

What does this change?

Control commands sent to a hub are queued on the hub's websocket send channel in the LiveControlGateway.
If the hub is slow to read, that queue backs up, and every command in it was still delivered once the hub caught up, however long it had waited. A shock or vibrate that arrives many seconds late is not what the sender asked for.

A queued control command now expires after 5 seconds (Duration.HubControlMaxQueueAge). When its turn comes and it is older than that, it is dropped and not written to the hub.

  • WebsocketBaseController gets a QueueMessage(data, maxQueueAge) overload. The deadline is taken from Stopwatch when the message is queued and checked in the same process when it is sent, so it does not depend on wall-clock time or on clocks matching between hosts.
  • HubV1Controller.Control and HubV2Controller.Control use the new overload.
  • Live control ticks (SendControl) are unchanged. They are sent and awaited one at a time and do not build a backlog.
  • Messages queued through the existing QueueMessage(data) never expire, as before.

This touches device control: commands that waited more than 5 seconds in the gateway's send queue are now discarded.

How was it tested?

  • API and LiveControlGateway build on this branch.
  • Common.Tests passes (217 tests).
  • No automated test covers the new drop path, and it has not been exercised against a real or simulated slow hub. The integration test suites were not run.

Checklist

  • The change is focused on one thing.
  • Tests, formatter and linter pass locally.
  • Documentation is updated where behaviour changed.
  • No secrets, credentials or personal data are included.
  • If this touches device control, limits, sharing, authentication or firmware updates, the description says so and explains how it was tested.

Control commands for a hub are queued on its websocket send channel. When
the hub is slow, that queue backs up, and everything in it was still
delivered later, including commands from an API token or session that had
been revoked, or a share that had been removed, in the meantime.

A control command now expires after 5 seconds in the send queue and is
dropped instead of written. Live control ticks are unaffected, they are
sent and awaited one at a time.
@hhvrc
hhvrc requested a balanced review from Copilot November 13, 2026 16:15
@hhvrc hhvrc self-assigned this Nov 13, 2026
@hhvrc
hhvrc requested a review from a team as a code owner November 13, 2026 16:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cd5e9793-f422-47f0-9c29-6daba159ba80
Commits

Reviewing files that changed from the base of the PR and between b188dce and 0cfbf6e.

Files selected for processing: 4

  • Common/Constants/Constants.cs
  • Common/Websocket/WebsockBaseController.cs
  • LiveControlGateway/Controllers/HubV1Controller.cs
  • LiveControlGateway/Controllers/HubV2Controller.cs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@hhvrc
hhvrc merged commit 2a7139c into develop Nov 13, 2026
25 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