feat: set peers lost when disconnected from coordinator (#11681)

Adds support to Coordination to call SetAllPeersLost() when it is closed. This ensure that when we disconnect from a Coordinator, we set all peers lost.

This covers CoderSDK (CLI client) and Agent.  Next PR will cover MultiAgent (notably, `wsproxy`).
This commit is contained in:
Spike Curtis
2024-01-22 15:26:20 +04:00
committed by GitHub
parent 9f6b38ce9c
commit 3d85cdfa11
4 changed files with 226 additions and 28 deletions
+10
View File
@@ -22,3 +22,13 @@ func RequireRecvCtx[A any](ctx context.Context, t testing.TB, c <-chan A) (a A)
return a
}
}
func RequireSendCtx[A any](ctx context.Context, t testing.TB, c chan<- A, a A) {
t.Helper()
select {
case <-ctx.Done():
t.Fatal("timeout")
case c <- a:
// OK!
}
}