Skip to content

Commit f19076c

Browse files
authored
chore: fix coordinator flake by moving pubsub below register (#6482)
After making the in-memory pubsub conform to the expectations of PostgreSQL, this flake started appearing. This fixes it because the agent socket is registered when a message is received.
1 parent ef2e86f commit f19076c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

enterprise/tailnet/coordinator.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,6 @@ func (c *haCoordinator) handleNextClientMessage(id, agent uuid.UUID, decoder *js
197197
func (c *haCoordinator) ServeAgent(conn net.Conn, id uuid.UUID, name string) error {
198198
c.agentNameCache.Add(id, name)
199199

200-
// Tell clients on other instances to send a callmemaybe to us.
201-
err := c.publishAgentHello(id)
202-
if err != nil {
203-
return xerrors.Errorf("publish agent hello: %w", err)
204-
}
205-
206200
// Publish all nodes on this instance that want to connect to this agent.
207201
nodes := c.nodesSubscribedToAgent(id)
208202
if len(nodes) > 0 {
@@ -241,6 +235,12 @@ func (c *haCoordinator) ServeAgent(conn net.Conn, id uuid.UUID, name string) err
241235
}
242236
c.mutex.Unlock()
243237

238+
// Tell clients on other instances to send a callmemaybe to us.
239+
err := c.publishAgentHello(id)
240+
if err != nil {
241+
return xerrors.Errorf("publish agent hello: %w", err)
242+
}
243+
244244
defer func() {
245245
c.mutex.Lock()
246246
defer c.mutex.Unlock()

0 commit comments

Comments
 (0)