You've already forked imgproxy
mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-12-01 23:11:31 +02:00
Drop cancelled requests in queue
This commit is contained in:
@@ -139,7 +139,11 @@ func handleProcessing(reqID string, rw http.ResponseWriter, r *http.Request) {
|
||||
defer startPrometheusDuration(prometheusRequestDuration)()
|
||||
}
|
||||
|
||||
processingSem <- struct{}{}
|
||||
select {
|
||||
case processingSem <- struct{}{}:
|
||||
case <-ctx.Done():
|
||||
panic(newError(499, "Request was cancelled before processing", "Cancelled"))
|
||||
}
|
||||
defer func() { <-processingSem }()
|
||||
|
||||
ctx, timeoutCancel := context.WithTimeout(ctx, time.Duration(conf.WriteTimeout)*time.Second)
|
||||
|
||||
Reference in New Issue
Block a user