From 0c25d2d6020f85911c4fc09175e29ed0e8f48fbd Mon Sep 17 00:00:00 2001 From: Alex Bramley Date: Sun, 10 Mar 2013 15:51:43 +0000 Subject: [PATCH] Hmm, this is failing occasionally now. Maybe I need a faster computer ;-) --- client/connection_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/connection_test.go b/client/connection_test.go index 939334d..0b73e58 100644 --- a/client/connection_test.go +++ b/client/connection_test.go @@ -489,15 +489,15 @@ func TestRateLimit(t *testing.T) { // So, time at the nanosecond resolution is a bit of a bitch. Choosing 60 // characters as the line length means we should be increasing badness by // 2.5 seconds minus the delta between the two ratelimit calls. This should - // be minimal but it's guaranteed that it won't be zero. Use 10us as a fuzz. + // be minimal but it's guaranteed that it won't be zero. Use 20us as a fuzz. if l := c.rateLimit(60); l != 0 || - abs(c.badness-2500*time.Millisecond) > 10*time.Microsecond { + abs(c.badness-2500*time.Millisecond) > 20*time.Microsecond { t.Errorf("Rate limit calculating badness incorrectly.") } // At this point, we can tip over the badness scale, with a bit of help. // 720 chars => +8 seconds of badness => 10.5 seconds => ratelimit if l := c.rateLimit(720); l != 8*time.Second || - abs(c.badness-10500*time.Millisecond) > 10*time.Microsecond { + abs(c.badness-10500*time.Millisecond) > 20*time.Microsecond { t.Errorf("Rate limit failed to return correct limiting values.") t.Errorf("l=%d, badness=%d", l, c.badness) }