Skip to content

Commit

Permalink
test a tiny buffer for udpate channels to avoid stalling
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Nov 27, 2023
1 parent c6fc3e3 commit 57f3dfc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hscontrol/poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,11 @@ func (h *Headscale) handlePoll(
h.pollNetMapStreamWG.Add(1)
defer h.pollNetMapStreamWG.Done()

updateChan := make(chan types.StateUpdate)
// Use a buffered channel in case a node is not fully ready
// to receive a message to make sure we dont block the entire
// notifier.
// 12 is arbitrarily chosen.
updateChan := make(chan types.StateUpdate, 12)
defer closeChanWithLog(updateChan, node.Hostname, "updateChan")

// Register the node's update channel
Expand Down

0 comments on commit 57f3dfc

Please sign in to comment.