From d8f58df39a4f20c1783403679dd6e483d02bdb13 Mon Sep 17 00:00:00 2001 From: what Date: Tue, 30 May 2023 17:54:30 +0800 Subject: [PATCH] =?UTF-8?q?[doc]=20=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- grpcall_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/grpcall_test.go b/grpcall_test.go index bba6ce0..0175eaf 100644 --- a/grpcall_test.go +++ b/grpcall_test.go @@ -92,6 +92,9 @@ func TestInvokeBidiStream(t *testing.T) { flag := make(chan bool) go func() { + timer := time.NewTimer(time.Second) + defer timer.Stop() + for { select { case msg := <-recv: @@ -102,9 +105,11 @@ func TestInvokeBidiStream(t *testing.T) { } flag <- true return - case <-time.After(time.Second): + case <-timer.C: resp.Cancel() + timer.Reset(time.Second) } + } }()