Share one fetch and transcode among concurrent misses (closes #65)
check / check (push) Successful in 4m20s
check / check (push) Successful in 4m20s
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 ignores its cancellation but keeps its deadline; 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, up to its deadline. Each request counts one miss; the processing counts its fetch and transcode once. A panic while processing is reported through the request's Sentry hub, when there is one, and becomes an error instead of stopping pixad. Model: opus-5-5
This commit is contained in:
@@ -107,6 +107,14 @@ 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 even if the first request's client goes away,
|
||||
until that request's `downstream_timeout` ends.
|
||||
|
||||
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