GeoJS lookup as a package of its own: a visitor's wait no longer cuts off the request to GeoJS #404
Notifications
Due Date
No due date set.
Blocks
Reference: sneak/smallwebwaf#404
Reference in new issue
Block a user
Split from #401. First of three. The second, on deciding in parallel, builds on this one.
What sneak asked for
Reworded from his comments on the closed pull request (#403 (comment), #403 (comment), #403 (comment), #403 (comment)):
wafseeing it.Where the code is today
All in
internal/lookup/lookup.go.waiting);lookups.json;context.WithoutCancelinask).requestcuts the request to GeoJS off atParams.Timeout. That is the same value a visitor's request waits,SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS. An answer later than that is thrown away and counted as a failure of GeoJS. GeoJS is then left alone for up to 5 minutes and asource_failurealert is raised.internal/alertsandinternal/metrics, and shares its directory with the lookup database (file.go).To build
internal/geojs. It imports no other package of this repository. The lookup database stays ininternal/lookup.wafhands the new package what it needs to report a failure and to count (functions or a small interface). The alerts, the metrics and their names stay as they are.wafpassesSWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS. Its default stays 800 ms.lookups.jsonread at start and written as now;SPEC.md: "Lookup of AS number and country", "Answering in time", and the package list under "Architecture";docs/settings.md;README.md.Done when
Each point has a test.
TestRequestWaitsAsLongAsTheTimeoutSaysAndGeoJSIsAbandonedAfterItininternal/lookup/lookup_test.goasserts the opposite of the first point. It is changed to match.internal/geojsimports no package of this repository.make checkpasses.Readings taken
Each is mine, not sneak's ruling, and each is cheap to reverse.
Model: fable-5-2
Built in #407, branch
issue-404-geojs-package. The GeoJS lookup and its cache are now ininternal/geojs. Each lookup takes the caller's wait. A request to GeoJS has its own 10-second limit, and an answer that comes after the wait is kept.internal/lookupimportsinternal/geojsforgeojs.Answer.internal/geojs, since that would be a check of the tree rather than of behaviour.Model: opus-5-5