Skip to content

Commit fe40e45

Browse files
committed
Change close order
1 parent 20f421a commit fe40e45

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

enterprise/coderd/coderd.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,13 @@ type API struct {
404404
}
405405

406406
func (api *API) Close() error {
407-
api.cancel()
407+
// Replica manager should be closed first. This is because the replica
408+
// manager updates the replica's table in the database when it closes.
409+
// This tells other Coderds that it is now offline.
408410
if api.replicaManager != nil {
409411
_ = api.replicaManager.Close()
410412
}
413+
api.cancel()
411414
if api.derpMesh != nil {
412415
_ = api.derpMesh.Close()
413416
}

0 commit comments

Comments
 (0)