Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit203f48a

Browse files
authored
fix: extend locking in wsproxy to avoid race (and fix flake) (#14167)
1 parentb80d995 commit203f48a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

‎enterprise/wsproxy/wsproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ func (s *Server) pingSiblingReplicas(replicas []codersdk.Replica) {
463463
errStr:=pingSiblingReplicas(ctx,s.Logger,&s.replicaPingSingleflight,s.derpMeshTLSConfig,replicas)
464464
s.replicaErrMut.Lock()
465465
s.replicaErr=errStr
466-
s.replicaErrMut.Unlock()
466+
defers.replicaErrMut.Unlock()
467467
ifs.Options.ReplicaErrCallback!=nil {
468468
s.Options.ReplicaErrCallback(replicas,s.replicaErr)
469469
}

‎enterprise/wsproxy/wsproxy_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ resourceLoop:
312312
t.Parallel()
313313

314314
// Try to connect to the DERP server on the no-derp-proxy region.
315-
client,err:=derphttp.NewClient(key.NewNode(),proxyAPI3.Options.AccessURL.String(),func(formatstring,args...any) {})
315+
client,err:=derphttp.NewClient(key.NewNode(),proxyAPI3.Options.AccessURL.String(),func(string,...any) {})
316316
require.NoError(t,err)
317317

318318
ctx:=testutil.Context(t,testutil.WaitLong)
@@ -405,7 +405,7 @@ func TestDERPEndToEnd(t *testing.T) {
405405
proxyOnlyDERPMap.OmitDefaultRegions=true
406406
returntrue
407407
},testutil.WaitLong,testutil.IntervalMedium)
408-
newDERPMapper:=func(derpMap*tailcfg.DERPMap)*tailcfg.DERPMap {
408+
newDERPMapper:=func(_*tailcfg.DERPMap)*tailcfg.DERPMap {
409409
returnproxyOnlyDERPMap
410410
}
411411
api.AGPL.DERPMapper.Store(&newDERPMapper)
@@ -577,7 +577,7 @@ func TestWorkspaceProxyDERPMeshProbe(t *testing.T) {
577577
registerBrokenProxy:=func(ctx context.Context,t*testing.T,primaryAccessURL*url.URL,accessURL,tokenstring) uuid.UUID {
578578
t.Helper()
579579
// Create a HTTP server that always replies with 500.
580-
srv:=httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter,r*http.Request) {
580+
srv:=httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter,_*http.Request) {
581581
rw.WriteHeader(http.StatusInternalServerError)
582582
}))
583583
t.Cleanup(srv.Close)
@@ -848,7 +848,7 @@ func TestWorkspaceProxyDERPMeshProbe(t *testing.T) {
848848
proxy:=coderdenttest.NewWorkspaceProxyReplica(t,api,client,&coderdenttest.ProxyOptions{
849849
Name:"proxy-2",
850850
ProxyURL:proxyURL,
851-
ReplicaPingCallback:func(replicas []codersdk.Replica,errstring) {
851+
ReplicaPingCallback:func(_ []codersdk.Replica,errstring) {
852852
replicaPingErr<-err
853853
},
854854
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp