Share one fetch and transcode among concurrent misses (closes #65)
check / check (push) Waiting to run
check / check (push) Waiting to run
Requests that missed the same variant at once each fetched and transcoded it. They now share one call through golang.org/x/sync/singleflight, keyed on the variant cache key. The first request processes the variant with a context that does not end with its own; the others wait for its result, holding no connection or processing slot, and return as soon as their own context ends. The processing request waits even then, as before. Each request counts one miss; the processing counts its fetch and transcode once. A panic while processing becomes an error instead of stopping pixad. Model: opus-5-5
This commit is contained in:
@@ -107,6 +107,13 @@ or proxy cache keeps the image after pixa would refuse the URL. A URL with no
|
||||
expiry gets one year. `immutable` only stops a client revalidating while its
|
||||
copy is fresh.
|
||||
|
||||
When several requests for the same image, size, format, quality and fit miss
|
||||
the cache at once, they share one upstream fetch (or one read of the cached
|
||||
source) and one transcode: the first request does the work, and the others wait
|
||||
for its image or its error, holding no upstream connection or processing slot
|
||||
of their own. A waiting request stops waiting when its own client goes away;
|
||||
the work goes on for the others.
|
||||
|
||||
The login form (`POST /`) is limited to 5 attempts per minute per client
|
||||
address, counting an IPv6 client by its /64; an attempt over the limit is
|
||||
refused with 429 and a `Retry-After` header. Behind a reverse proxy the client
|
||||
|
||||
Reference in New Issue
Block a user