Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf287889

Browse files
authored
chore: move client pubsub for HA coordinator after register (#6487)
Similar fix that happened for the agent. See:https://github.com/coder/coder/actions/runs/4356099388/jobs/7613634277
1 parent4c204fc commitf287889

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

‎enterprise/tailnet/coordinator.go

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ func (c *haCoordinator) Node(id uuid.UUID) *agpl.Node {
8383
// with the specified ID.
8484
func (c*haCoordinator)ServeClient(conn net.Conn,id uuid.UUID,agent uuid.UUID)error {
8585
c.mutex.Lock()
86+
connectionSockets,ok:=c.agentToConnectionSockets[agent]
87+
if!ok {
88+
connectionSockets=map[uuid.UUID]*agpl.TrackedConn{}
89+
c.agentToConnectionSockets[agent]=connectionSockets
90+
}
91+
92+
now:=time.Now().Unix()
93+
// Insert this connection into a map so the agent
94+
// can publish node updates.
95+
connectionSockets[id]=&agpl.TrackedConn{
96+
Conn:conn,
97+
Start:now,
98+
LastWrite:now,
99+
}
100+
86101
// When a new connection is requested, we update it with the latest
87102
// node of the agent. This allows the connection to establish.
88103
node,ok:=c.nodes[agent]
@@ -103,23 +118,6 @@ func (c *haCoordinator) ServeClient(conn net.Conn, id uuid.UUID, agent uuid.UUID
103118
}
104119
}
105120

106-
c.mutex.Lock()
107-
connectionSockets,ok:=c.agentToConnectionSockets[agent]
108-
if!ok {
109-
connectionSockets=map[uuid.UUID]*agpl.TrackedConn{}
110-
c.agentToConnectionSockets[agent]=connectionSockets
111-
}
112-
113-
now:=time.Now().Unix()
114-
// Insert this connection into a map so the agent
115-
// can publish node updates.
116-
connectionSockets[id]=&agpl.TrackedConn{
117-
Conn:conn,
118-
Start:now,
119-
LastWrite:now,
120-
}
121-
c.mutex.Unlock()
122-
123121
deferfunc() {
124122
c.mutex.Lock()
125123
deferc.mutex.Unlock()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp