From 4dd804e45857237c3cb350ae651854575738dc92 Mon Sep 17 00:00:00 2001 From: Chao Wang Date: Thu, 23 Jun 2022 17:23:12 +0800 Subject: [PATCH] consts --- testkit/stepped.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testkit/stepped.go b/testkit/stepped.go index 36f488eb57351..d63a2a1efc7b8 100644 --- a/testkit/stepped.go +++ b/testkit/stepped.go @@ -27,6 +27,8 @@ import ( var errCommandRunFailed = errors.New("command run failed") +var defaultChanTimeout = time.Second * 10 + type steppedTestkitMsgType int const ( @@ -46,7 +48,7 @@ func (ch steppedTestKitMsgChan) sendMsg(tp steppedTestkitMsgType, val any) error select { case ch <- &steppedTestKitMsg{tp: tp, val: val}: return nil - case <-time.After(time.Second * 10): + case <-time.After(defaultChanTimeout): return errors.New("send msg timeout") } } @@ -59,7 +61,7 @@ func (ch steppedTestKitMsgChan) recvMsg() (*steppedTestKitMsg, error) { select { case msg := <-ch: return msg, nil - case <-time.After(time.Second * 10): + case <-time.After(defaultChanTimeout): return nil, errors.New("send msg timeout") } }