Lengthen the WHOIS fetcher's wait after a skipped lookup (closes #222)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
A lookup whose RIR is paused is skipped. The skip left the fetcher's wait as it was. Each lookup asks IANA before it finds its RIR paused. So while most stale ASes belonged to a paused RIR, the fetcher could ask IANA every second. Like a failure, a skipped lookup now makes the wait 1.5 times as long, up to one minute. The skip is still not counted as a failure, so the status page's failure figures leave it out. Model: opus-5-5
This commit was merged in pull request #223.
This commit is contained in:
1 parent
26d939ad72
commit
d66c59ef07
3 files changed
+68
-8
No files matched your search
@@ -196,6 +196,48 @@ func TestFetchAndUpdateWaitsOutAPause(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestFetchAndUpdateBacksOffDuringAPause looks up an AS at RIPE while RIPE
|
||||
// refuses the query. The refusal pauses RIPE for an hour, so every later
|
||||
// lookup in the test is skipped. The test sets the WHOIS client's clock and
|
||||
// looks the AS up again each time the interval has passed. Like a failure,
|
||||
// each skip must make the interval 1.5 times as long, up to one minute. The
|
||||
// skips must not count as failures.
|
||||
func TestFetchAndUpdateBacksOffDuringAPause(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
f, _ := newFetcherWithWHOISAnswers(t, map[string]string{
|
||||
ianaWHOISServer: ianaRefersToRIPE,
|
||||
ripeWHOISServer: ripeAccessDenied,
|
||||
})
|
||||
|
||||
now := time.Date(2026, 11, 2, 0, 0, 0, 0, time.UTC)
|
||||
f.whoisClient.Now = func() time.Time { return now }
|
||||
|
||||
f.fetchAndUpdate(t.Context(), testASNA)
|
||||
|
||||
for i, want := range []time.Duration{
|
||||
33750 * time.Millisecond,
|
||||
50625 * time.Millisecond,
|
||||
time.Minute,
|
||||
time.Minute,
|
||||
} {
|
||||
now = now.Add(f.getInterval())
|
||||
|
||||
f.fetchAndUpdate(t.Context(), testASNA)
|
||||
|
||||
if got := f.getInterval(); got != want {
|
||||
t.Errorf("interval after %d skipped lookups = %v, want %v",
|
||||
i+1, got, want)
|
||||
}
|
||||
}
|
||||
|
||||
got := f.GetStats()
|
||||
if got.ConsecutiveFails != 1 || got.ErrorsLastHour != 1 {
|
||||
t.Errorf("%d failures in a row and %d errors, want 1 and 1",
|
||||
got.ConsecutiveFails, got.ErrorsLastHour)
|
||||
}
|
||||
}
|
||||
|
||||
// TestFetchAndUpdateKeepsAskingIANA looks up an AS while IANA's server
|
||||
// refuses the connection. The test sets the WHOIS client's clock. The next
|
||||
// lookup comes a second before whois.PauseTime has passed. IANA is never
|
||||
|
||||
Reference in new issue
Block a user