From 513a6c7513bc6621efa4a7840d4b59d5edec6167 Mon Sep 17 00:00:00 2001 From: Alliballibaba Date: Fri, 9 May 2025 19:44:26 +0200 Subject: [PATCH] Fixes metrics also with regular request timeouts. --- context.go | 4 ++-- threadregular.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/context.go b/context.go index 822a5ff5c6..29ed40af30 100644 --- a/context.go +++ b/context.go @@ -152,9 +152,9 @@ func (fc *frankenPHPContext) reject(statusCode int, message string) { if rw != nil { rw.WriteHeader(statusCode) _, _ = rw.Write([]byte(message)) - + if f, ok := rw.(http.Flusher); ok { - f.Flush() + f.Flush() } } diff --git a/threadregular.go b/threadregular.go index 5dee45502e..817e337f7d 100644 --- a/threadregular.go +++ b/threadregular.go @@ -118,6 +118,7 @@ func handleRequestWithRegularPHPThreads(fc *frankenPHPContext) { // the request has triggered scaling, continue to wait for a thread case <-timeoutChan(maxWaitTime): // the request has timed out stalling + metrics.DequeuedRequest() fc.reject(504, "Gateway Timeout") return }