Repository navigation
fix: drop hub control commands that waited too long to send - #393
Merged
Merged
Conversation
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.
|
Warning Review limit reachedYou'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. View limit details
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. |
LucHeart
approved these changes
Nov 13, 2026
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.
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.WebsocketBaseControllergets aQueueMessage(data, maxQueueAge)overload. The deadline is taken fromStopwatchwhen 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.ControlandHubV2Controller.Controluse the new overload.SendControl) are unchanged. They are sent and awaited one at a time and do not build a backlog.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?
APIandLiveControlGatewaybuild on this branch.Common.Testspasses (217 tests).Checklist