Stop waiting for count writes after a request's deadline (closes #224)
check / check (push) Waiting to run

TestService_Get_ReturnsByItsDeadline failed on a busy host because its
request, past its deadline, still waited for its miss count to be
written, a database write with no deadline; in pixad that write waits
for the one database connection every request shares. The hit, miss,
upstream fetch and transform counts are now each written in a goroutine
of their own, which the request waits for only until its deadline; a
count not written by then is written after it returns. Shutdown waits
for those writes within ShutdownTimeout and reports any left unfinished.
The test phase also runs go test with -parallel 4: on a busy host, as
many tests at once as there are CPUs wait so long to be scheduled that
a timed request can fail.

Model: opus-5-5
This commit is contained in:
2026-10-08 13:33:44 +00:00
parent bdde021b45
commit 2a7af1b1be
7 changed files with 235 additions and 19 deletions
+15
View File
@@ -30,6 +30,21 @@ P2: security: per-IP rate limiting on the image routes
# Completed Steps
- 2026-10-08 a request past its deadline no longer waits for a database write
(closes #224). On a busy host, `TestService_Get_ReturnsByItsDeadline` failed
because its request returned over a second after its deadline: it was still
waiting for its miss count to be written to the database, a write with no
deadline, which in pixad waits for the one database connection that every
request shares. The hit, miss, upstream fetch and transform counts are now
each written in a goroutine of their own, which the request waits for only
until its deadline; a count not written by then is written after the request
returns. On shutdown pixad waits for those writes within the same 5 seconds as
for the images being processed, and exits with 1 when some are unfinished. The
test phase of the `Dockerfile` also runs at most 4 tests of a package at once
(`go test -parallel 4`), where it ran as many as the host has CPUs: on a busy
host they then wait so long to be scheduled that a test that times a request
can fail. `-p`, how many packages are tested at once, is unchanged, as capping
it also slows compiling.
- 2026-10-08 every output format is saved with settings pixa sets on purpose
(closes #232): each format has its own govips export, as JPEG XL does, in
place of govips' generic `Export`, which sent libvips a zero for some settings