parent
c5066e84e2
commit
3ecd7f04e4
|
@ -11,7 +11,7 @@ func TestRateLimit(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
now()
|
now()
|
||||||
limit := NewRateLimit(time.Second * 2)
|
limit := NewRateLimit(time.Second)
|
||||||
|
|
||||||
if ok := limit.Try(); !ok {
|
if ok := limit.Try(); !ok {
|
||||||
now()
|
now()
|
||||||
|
@ -25,7 +25,7 @@ func TestRateLimit(t *testing.T) {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Millisecond * 500)
|
||||||
|
|
||||||
if ok := limit.Try(); ok {
|
if ok := limit.Try(); ok {
|
||||||
now()
|
now()
|
||||||
|
@ -33,7 +33,7 @@ func TestRateLimit(t *testing.T) {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Millisecond * 500)
|
||||||
|
|
||||||
if ok := limit.Try(); !ok {
|
if ok := limit.Try(); !ok {
|
||||||
now()
|
now()
|
||||||
|
|
Loading…
Reference in New Issue