1
mirror of https://github.com/rclone/rclone synced 2024-11-26 04:07:22 +01:00

pacer: attempt to fix occasional "beginSleep didn't fire" test failures

This commit is contained in:
Nick Craig-Wood 2018-02-27 11:06:59 +00:00
parent 62540b4007
commit 77f344a69d

View File

@ -212,7 +212,7 @@ func TestBeginCall(t *testing.T) {
connTime := time.Now()
p.connTokens <- struct{}{}
time.Sleep(1 * time.Millisecond)
paceTime := waitForPace(p, 10*time.Millisecond)
paceTime := waitForPace(p, 1000*time.Millisecond)
if paceTime.IsZero() {
t.Errorf("beginSleep didn't fire")
} else if paceTime.Sub(startTime) < 0 {
@ -232,7 +232,7 @@ func TestBeginCallZeroConnections(t *testing.T) {
startTime := time.Now()
p.pacer <- struct{}{}
time.Sleep(1 * time.Millisecond)
paceTime := waitForPace(p, 10*time.Millisecond)
paceTime := waitForPace(p, 1000*time.Millisecond)
if paceTime.IsZero() {
t.Errorf("beginSleep didn't fire")
} else if paceTime.Sub(startTime) < 0 {