chore: code refactoring (#5204)

This commit is contained in:
Kevin Wan
2025-10-02 21:48:03 +08:00
committed by GitHub
parent 440884105e
commit fa85c84af3

View File

@@ -127,6 +127,14 @@ func dumpRequest(r *http.Request) string {
return string(reqContent)
}
func getSlowThreshold(r *http.Request) time.Duration {
if r.Header.Get(headerAccept) == valueSSE {
return sseSlowThreshold.Load()
} else {
return slowThreshold.Load()
}
}
func isOkResponse(code int) bool {
// not server error
return code < http.StatusInternalServerError
@@ -234,12 +242,3 @@ func wrapStatusCode(code int) string {
return logx.WithColorPadding(strconv.Itoa(code), colour)
}
func getSlowThreshold(r *http.Request) time.Duration {
threshold := slowThreshold.Load()
if r.Header.Get(headerAccept) == valueSSE {
threshold = sseSlowThreshold.Load()
}
return threshold
}