Skip to content

Commit e454e42

Browse files
deansheatherethanndickson
authored andcommitted
chore: add test for coord rolling restart
1 parent c3c23ed commit e454e42

File tree

4 files changed

+346
-6
lines changed

4 files changed

+346
-6
lines changed

coderd/coderd.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,9 +1485,6 @@ func (api *API) Close() error {
14851485
default:
14861486
api.cancel()
14871487
}
1488-
if api.derpCloseFunc != nil {
1489-
api.derpCloseFunc()
1490-
}
14911488

14921489
wsDone := make(chan struct{})
14931490
timer := time.NewTimer(10 * time.Second)
@@ -1513,11 +1510,14 @@ func (api *API) Close() error {
15131510
api.updateChecker.Close()
15141511
}
15151512
_ = api.workspaceAppServer.Close()
1513+
_ = api.agentProvider.Close()
1514+
if api.derpCloseFunc != nil {
1515+
api.derpCloseFunc()
1516+
}
15161517
coordinator := api.TailnetCoordinator.Load()
15171518
if coordinator != nil {
15181519
_ = (*coordinator).Close()
15191520
}
1520-
_ = api.agentProvider.Close()
15211521
_ = api.statsReporter.Close()
15221522
_ = api.NetworkTelemetryBatcher.Close()
15231523
_ = api.OIDCConvertKeyCache.Close()

coderd/tailnet.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ func NewServerTailnet(
7575
// given in this callback, it's only valid while connecting.
7676
if derpServer != nil {
7777
conn.SetDERPRegionDialer(func(_ context.Context, region *tailcfg.DERPRegion) net.Conn {
78-
if !region.EmbeddedRelay {
78+
// Don't set up the embedded relay if we're shutting down
79+
if !region.EmbeddedRelay || ctx.Err() != nil {
7980
return nil
8081
}
8182
logger.Debug(ctx, "connecting to embedded DERP via in-memory pipe")

0 commit comments

Comments
 (0)