Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf88945

Browse files
committed
fix: Defer close of nhooyr/websocket to wait for exit
nhooyr/websocket properly awaits for the close status to send. We must wait for the connection to close before returning the handler.
1 parent 8f843d2 commit cf88945

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

coderd/provisionerdaemons.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ func (api *api) provisionerDaemonsServe(rw http.ResponseWriter, r *http.Request)
100100
err = server.Serve(r.Context(), session)
101101
if err != nil {
102102
_ = conn.Close(websocket.StatusInternalError, fmt.Sprintf("serve: %s", err))
103+
return
103104
}
105+
_ = conn.Close(websocket.StatusNormalClosure, "")
104106
}
105107

106108
// The input for a "workspace_provision" job.

0 commit comments

Comments
 (0)