Skip to content

Commit 07e4938

Browse files
committed
fix: race testcode
1 parent 408e073 commit 07e4938

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: testingconnection_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ func (t *testingConnection) Timeout() time.Duration {
4646
}
4747

4848
func (t *testingConnection) ConnectionID() string {
49+
connNumMx.Lock()
50+
defer connNumMx.Unlock()
4951
if t.connectionID == "" {
50-
defer connNumMx.Unlock()
51-
connNumMx.Lock()
5252
connNum++
5353
t.connectionID = fmt.Sprintf("test%v", connNum)
5454
}

0 commit comments

Comments
 (0)