mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-20 00:21:21 +00:00
Use Ticker in Repeat again to avoid drift
This commit is contained in:
@ -39,11 +39,11 @@ func (c *rCounter) Read() {
|
||||
func TestRepeat(test *testing.T) {
|
||||
assert := asrt.New(test)
|
||||
|
||||
dur := time.Duration(50) * time.Millisecond
|
||||
dur := time.Duration(100) * time.Millisecond
|
||||
short := time.Duration(20) * time.Millisecond
|
||||
// delay waits for cnt durations, an a little extra
|
||||
delay := func(cnt int) time.Duration {
|
||||
return time.Duration(cnt)*dur + time.Duration(5)*time.Millisecond
|
||||
return time.Duration(cnt)*dur + time.Duration(10)*time.Millisecond
|
||||
}
|
||||
t := NewRepeatTimer("bar", dur)
|
||||
|
||||
@ -70,7 +70,7 @@ func TestRepeat(test *testing.T) {
|
||||
// after a stop, nothing more is sent
|
||||
stopped := t.Stop()
|
||||
assert.True(stopped)
|
||||
time.Sleep(delay(7))
|
||||
time.Sleep(delay(2))
|
||||
assert.Equal(6, c.Count())
|
||||
|
||||
// extra calls to stop don't block
|
||||
|
Reference in New Issue
Block a user