waf: end the asks to GeoJS, the DNSBL zones, AbuseIPDB and routewatch at the stop (closes #439) #463

Open
clawbot wants to merge 1 commits from issue-439-stop-asks-at-stop into next
pull from: issue-439-stop-asks-at-stop
Collaborator

Closes #439

At an orderly stop, waf now ends the asks a request started in the background before it writes the state and cache files. Before this change nothing waited for them, so an answer could change a table after the last write.

The four methods, each added as an fx stop hook by its provider in internal/sww/waf.go:

  • geojs.GeoJS.StopAsking: ends the request to GeoJS under way and returns once the goroutine that made it has. After it, GeoJS is asked nothing.
  • reputation.DNSBL.StopAsking: ends the queries to the DNSBL zones under way and returns once their goroutines have. After it, ListedBy asks no zone.
  • reputation.AbuseIPDB.StopChecking: ends the checks under way and returns once their goroutines have. After it, Hit checks no client.
  • routewatch.Client.StopAsking: ends the queries to routewatch under way and returns once their goroutines have. After it, Route asks routewatch nothing.

An ask ended this way is no failure. It raises no alert, counts no failure and sets no wait before the next ask.

What the diff does not show:

  • Each ask still runs on context.WithoutCancel of the request's context, so it outlives the request. A cancel function, kept per ask, now ends it at the stop.
  • The asks are ended, not waited out, as the issue's deviation section says. An AbuseIPDB check ended this way stays spent from the day's budget.
  • fx stops serving before these hooks, because serve adds its hook after every part it uses.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/smallwebwaf/issues/439 At an orderly stop, `waf` now ends the asks a request started in the background before it writes the state and cache files. Before this change nothing waited for them, so an answer could change a table after the last write. The four methods, each added as an fx stop hook by its provider in `internal/sww/waf.go`: - `geojs.GeoJS.StopAsking`: ends the request to GeoJS under way and returns once the goroutine that made it has. After it, GeoJS is asked nothing. - `reputation.DNSBL.StopAsking`: ends the queries to the DNSBL zones under way and returns once their goroutines have. After it, `ListedBy` asks no zone. - `reputation.AbuseIPDB.StopChecking`: ends the checks under way and returns once their goroutines have. After it, `Hit` checks no client. - `routewatch.Client.StopAsking`: ends the queries to routewatch under way and returns once their goroutines have. After it, `Route` asks routewatch nothing. An ask ended this way is no failure. It raises no alert, counts no failure and sets no wait before the next ask. What the diff does not show: - Each ask still runs on `context.WithoutCancel` of the request's context, so it outlives the request. A cancel function, kept per ask, now ends it at the stop. - The asks are ended, not waited out, as the issue's deviation section says. An AbuseIPDB check ended this way stays spent from the day's budget. - fx stops serving before these hooks, because `serve` adds its hook after every part it uses. Model: opus-5-5
clawbot added the needs-review label 2026-11-19 17:48:30 +01:00
clawbot self-assigned this 2026-11-19 17:48:30 +01:00
clawbot added 1 commit 2026-11-19 17:48:30 +01:00
Each of the four keeps the cancel function of every ask it started, and a
wait group of their goroutines. Its new method (GeoJS.StopAsking,
DNSBL.StopAsking, AbuseIPDB.StopChecking, routewatch Client.StopAsking)
refuses further asks, ends those under way, and returns once their
goroutines have. An ask ended that way is no failure: no alert, no failure
count, no wait before the next. Each provider in internal/sww adds the
method as a stop hook, so the last write of the state files follows it.

Model: opus-5-5
Author
Collaborator

Verdict: PASS
Head: 145b80cc08

The four stop methods and their stop hooks meet every point of the definition of done in #439, and each new test fails when its method's behaviour is broken.

Model: opus-5-5

Verdict: PASS Head: 145b80cc08720ba13a0b0e831641b08cbc9e622b The four stop methods and their stop hooks meet every point of the definition of done in https://git.eeqj.de/sneak/smallwebwaf/issues/439, and each new test fails when its method's behaviour is broken. Model: opus-5-5
Some checks are pending
check / check (push) Waiting to run
You are not authorized to merge this pull request.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-439-stop-asks-at-stop:issue-439-stop-asks-at-stop
git checkout issue-439-stop-asks-at-stop
Sign in to join this conversation.