From 57f3dfcc97b539824feaa3dd6004505352d286f3 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Mon, 27 Nov 2023 11:20:46 +0000 Subject: [PATCH] test a tiny buffer for udpate channels to avoid stalling Signed-off-by: Kristoffer Dalby --- hscontrol/poll.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hscontrol/poll.go b/hscontrol/poll.go index 4e7f3489401..a1a01b43ebc 100644 --- a/hscontrol/poll.go +++ b/hscontrol/poll.go @@ -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