Make the load-sensitive tests wait for what they check (closes #507)
check / check (push) Successful in 10m37s

The browser test waits for each page a click opens to load, and for
Alpine.js to start on it, before reading that page; before, a read
could find an element of the page being left.

The delivery tests' drain takes what is queued without a timer. The
dispatch paths queue before they return, and the 25 ms timer could be
due by the time select looked, which then chose at random between it
and a queued task.

The test phase keeps the tests' temporary directories, and with them
their SQLite databases, on a tmpfs: waiting for the disk at each commit
was about 40% of internal/handlers' run time on a busy host.

Model: opus-5-5
This commit is contained in:
2026-10-06 05:42:57 +00:00
committed by sneak
parent faf3da9a75
commit a424939b5d
3 changed files with 37 additions and 13 deletions
+4 -3
View File
@@ -48,8 +48,9 @@ func fSweepSetup(
//
// Every caller drives the dispatch paths synchronously and has already
// waited for them to return, so anything they queued is in the channel
// by now. The short grace covers nothing but scheduler jitter, and is
// kept small because one of these tests runs the drain forty times.
// by now, and nothing is waited for. A timer here would race the queued
// tasks: on a busy host it can be due by the time select looks, and
// select picks at random among the cases that are ready.
func fDrain(e *delivery.Engine) []delivery.Task {
var out []delivery.Task
@@ -59,7 +60,7 @@ func fDrain(e *delivery.Engine) []delivery.Task {
out = append(out, task)
case task := <-e.ExportRetryCh():
out = append(out, task)
case <-time.After(25 * time.Millisecond):
default:
return out
}
}