MCPcopy Index your code
hub / github.com/coder/coder / Chunked

Method Chunked

tailnet/proto/response.go:11–22  ·  view source on GitHub ↗

Chunked splits the response into multiple responses, each containing at most maxPeerUpdatesPerMessage peer updates to stay under the DRPC 4 MiB transport limit.

()

Source from the content-addressed store, hash-verified

9// at most maxPeerUpdatesPerMessage peer updates to stay under the DRPC
10// 4 MiB transport limit.
11func (r *CoordinateResponse) Chunked() []*CoordinateResponse {
12 updates := r.GetPeerUpdates()
13 if len(updates) <= maxPeerUpdatesPerMessage {
14 return []*CoordinateResponse{r}
15 }
16 var chunks []*CoordinateResponse
17 for i := 0; i < len(updates); i += maxPeerUpdatesPerMessage {
18 end := min(i+maxPeerUpdatesPerMessage, len(updates))
19 chunks = append(chunks, &CoordinateResponse{PeerUpdates: updates[i:end]})
20 }
21 return chunks
22}

Callers 3

runMethod · 0.80

Calls 1

GetPeerUpdatesMethod · 0.95

Tested by 1