diff --git a/internal/acoustid/client_test.go b/internal/acoustid/client_test.go index 3226fcc4..437388ed 100644 --- a/internal/acoustid/client_test.go +++ b/internal/acoustid/client_test.go @@ -198,10 +198,14 @@ func TestLookup_KeepsToTheRateLimit(t *testing.T) { t.Fatal(err) } } + // The client spaces its sends by minInterval; the server sees arrivals, + // which transit can bunch by a few milliseconds (389ms under -race, CI run + // 9543). What AcoustID enforces is 3 a second at its end, so that is the + // bound: minInterval's headroom is what absorbs the bunching. + const serviceLimit = time.Second / 3 for i := 1; i < len(at); i++ { - // A little slack for the server's own clock reading. - if gap := at[i].Sub(at[i-1]); gap < minInterval-10*time.Millisecond { - t.Errorf("requests %d and %d were %s apart, want at least %s", i-1, i, gap, minInterval) + if gap := at[i].Sub(at[i-1]); gap < serviceLimit { + t.Errorf("requests %d and %d arrived %s apart, want at least %s", i-1, i, gap, serviceLimit) } } }