A request that waited for its lookup is counted when it goes on (closes #129)
check / check (push) Waiting to run

checkClient read the time before the lookup, which can wait for GeoJS
up to SWWAF_LOOKUP_TIMEOUT, and the rate limits counted the request at
that time. Two requests of a new client waiting across the end of a
minute could then be counted out of order, and the one dated more than a
second before the minute under way began made the rate limits start
that window afresh, as for a clock set back: the other request's count
was lost. The checks after the lookup now read the time again.

Model: opus-5-5
This commit was merged in pull request #133.
This commit is contained in:
2026-10-14 19:41:54 +02:00
parent 27f0007b54
commit 7a9471df28
2 changed files with 75 additions and 0 deletions
+6
View File
@@ -261,6 +261,12 @@ func (rq *request) checkClient(ctx context.Context) string {
rq.lookUp(ctx)
// The lookup can wait for GeoJS, so the checks after it read the time
// again: a request counted at the time it arrived could be counted
// after a later one of its client's, which the rate limits would take
// for the clock set back.
now = rq.h.now()
if rq.countryDenied() {
return requestlog.ActionCountryDenied
}