Skip to content

Commit

Permalink
consts
Browse files Browse the repository at this point in the history
  • Loading branch information
lcwangchao committed Jun 23, 2022
1 parent d6b4150 commit 4dd804e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions testkit/stepped.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (

var errCommandRunFailed = errors.New("command run failed")

var defaultChanTimeout = time.Second * 10

type steppedTestkitMsgType int

const (
Expand All @@ -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")
}
}
Expand All @@ -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")
}
}
Expand Down

0 comments on commit 4dd804e

Please sign in to comment.