Skip to content

client: Replace SetOrdered with AddChannel - #3797

Open
jochumdev wants to merge 4 commits into
lxc:mainfrom
jochumdev:feat/addchannel
Open

client: Replace SetOrdered with AddChannel#3797
jochumdev wants to merge 4 commits into
lxc:mainfrom
jochumdev:feat/addchannel

Conversation

@jochumdev

Copy link
Copy Markdown
Member

AddChannel lets a consumer receive events in order without a goroutine
per event, and since it hands back a channel it can be consumed with a
plain for range loop — no extra channel and forwarding goroutine on the
consumer side.

AddHandler is untouched and incusd keeps using it for operations.

A reader that falls too far behind is dropped rather than having events
silently skipped, so a stale view can't go unnoticed.

This reverts commit 0a97515.

Signed-off-by: René Jochum <rene@jochum.dev>
@jochumdev
jochumdev requested a review from stgraber as a code owner August 7, 2026 16:59
@github-actions github-actions Bot added the Documentation Documentation needs updating label Aug 7, 2026
Comment thread doc/events.md
Comment thread doc/events.md
@@ -22,8 +22,8 @@ reconnecting, anything being tracked from the event stream should be re-fetched,
disconnected are not resent.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is there a doc change in this commit?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Handlers are called concurrently so they can observe events out of
order. A channel delivers them one at a time in the order they arrived
and lets the reader apply backpressure. A reader that falls too far
behind is dropped rather than having events silently skipped.

The overflow path cancels a listener without removing it, so Disconnect
has to do the removal unconditionally.

Signed-off-by: René Jochum <rene@jochum.dev>
Signed-off-by: René Jochum <rene@jochum.dev>
Signed-off-by: René Jochum <rene@jochum.dev>
@jochumdev

jochumdev commented Aug 9, 2026

Copy link
Copy Markdown
Member Author

I have written a fork of incus/v7/client means I have no need for this, if incus has no use for this drop it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Documentation needs updating

Development

Successfully merging this pull request may close these issues.

2 participants