mirror of https://github.com/coder/coder.git
chore: fix servertailnet test flake (#10110)
https://github.com/coder/coder/actions/runs/6424100765/job/17444018788?pr=10083#step:5:771
This commit is contained in:
parent
2d2bea79a7
commit
03a7d2f70b
|
@ -229,6 +229,10 @@ func (s *ServerTailnet) watchAgentUpdates() {
|
|||
|
||||
err := s.conn.UpdateNodes(nodes, false)
|
||||
if err != nil {
|
||||
if xerrors.Is(err, tailnet.ErrConnClosed) {
|
||||
s.logger.Warn(context.Background(), "tailnet conn closed, exiting watchAgentUpdates", slog.Error(err))
|
||||
return
|
||||
}
|
||||
s.logger.Error(context.Background(), "update node in server tailnet", slog.Error(err))
|
||||
return
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ import (
|
|||
"github.com/coder/coder/v2/cryptorand"
|
||||
)
|
||||
|
||||
var ErrConnClosed = xerrors.New("connection closed")
|
||||
|
||||
const (
|
||||
WorkspaceAgentSSHPort = 1
|
||||
WorkspaceAgentReconnectingPTYPort = 2
|
||||
|
@ -496,7 +498,7 @@ func (c *Conn) UpdateNodes(nodes []*Node, replacePeers bool) error {
|
|||
defer c.mutex.Unlock()
|
||||
|
||||
if c.isClosed() {
|
||||
return xerrors.New("connection closed")
|
||||
return ErrConnClosed
|
||||
}
|
||||
|
||||
status := c.Status()
|
||||
|
@ -590,7 +592,7 @@ func (c *Conn) RemovePeer(selector PeerSelector) (deleted bool, err error) {
|
|||
defer c.mutex.Unlock()
|
||||
|
||||
if c.isClosed() {
|
||||
return false, xerrors.New("connection closed")
|
||||
return false, ErrConnClosed
|
||||
}
|
||||
|
||||
deleted = false
|
||||
|
@ -919,7 +921,7 @@ func (c *Conn) Listen(network, addr string) (net.Listener, error) {
|
|||
c.mutex.Lock()
|
||||
if c.isClosed() {
|
||||
c.mutex.Unlock()
|
||||
return nil, xerrors.New("closed")
|
||||
return nil, ErrConnClosed
|
||||
}
|
||||
if c.listeners == nil {
|
||||
c.listeners = map[listenKey]*listener{}
|
||||
|
|
Loading…
Reference in New Issue