avoid data race for testing (#19635)

This commit is contained in:
jiuker 2024-04-30 23:03:35 +08:00 committed by GitHub
parent 3cf8a7c888
commit 6bb10a81a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -470,7 +470,7 @@ func testStreamCancel(t *testing.T, local, remote *Manager) {
Handle: func(ctx context.Context, payload []byte, request <-chan []byte, resp chan<- []byte) *RemoteErr { Handle: func(ctx context.Context, payload []byte, request <-chan []byte, resp chan<- []byte) *RemoteErr {
<-ctx.Done() <-ctx.Done()
serverCanceled <- struct{}{} serverCanceled <- struct{}{}
t.Log(GetCaller(ctx).Name, "Server Context canceled") fmt.Println(GetCaller(ctx).Name, "Server Context canceled")
return nil return nil
}, },
OutCapacity: 1, OutCapacity: 1,
@ -480,7 +480,7 @@ func testStreamCancel(t *testing.T, local, remote *Manager) {
Handle: func(ctx context.Context, payload []byte, request <-chan []byte, resp chan<- []byte) *RemoteErr { Handle: func(ctx context.Context, payload []byte, request <-chan []byte, resp chan<- []byte) *RemoteErr {
<-ctx.Done() <-ctx.Done()
serverCanceled <- struct{}{} serverCanceled <- struct{}{}
t.Log(GetCaller(ctx).Name, "Server Context canceled") fmt.Println(GetCaller(ctx).Name, "Server Context canceled")
return nil return nil
}, },
OutCapacity: 1, OutCapacity: 1,