Quicker rate limit test

Signed-off-by: Etzelia <etzelia@hotmail.com>
pull/8/head
Etzelia 2021-05-04 21:55:25 -05:00
parent c5066e84e2
commit 3ecd7f04e4
No known key found for this signature in database
GPG Key ID: 708511AE7ABC5314
1 changed files with 3 additions and 3 deletions

View File

@ -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()