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

Skip to content

Commit 299d30c

Browse files
committed
Fix race condition
1 parent aaefcaf commit 299d30c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

coderd/workspaceagents.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ func (api *API) workspaceAgentCoordinate(rw http.ResponseWriter, r *http.Request
352352
closeChan := make(chan struct{})
353353
go func() {
354354
defer close(closeChan)
355-
err = api.TailnetCoordinator.ServeAgent(wsNetConn, workspaceAgent.ID)
355+
err := api.TailnetCoordinator.ServeAgent(wsNetConn, workspaceAgent.ID)
356356
if err != nil {
357357
_ = conn.Close(websocket.StatusInternalError, err.Error())
358358
return
@@ -375,7 +375,7 @@ func (api *API) workspaceAgentCoordinate(rw http.ResponseWriter, r *http.Request
375375
_ = conn.Close(websocket.StatusAbnormalClosure, err.Error())
376376
return
377377
}
378-
err = ensureLatestBuild()
378+
err := ensureLatestBuild()
379379
if err != nil {
380380
// Disconnect agents that are no longer valid.
381381
_ = conn.Close(websocket.StatusGoingAway, "")

0 commit comments

Comments
 (0)