more features
This commit is contained in:
@@ -1405,7 +1405,8 @@ func handleRequest(w http.ResponseWriter, r *http.Request, backends []Backend, c
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
|
||||||
|
// Don't close resp.Body here - it will be closed by the winner or drained by losers
|
||||||
|
|
||||||
// Signal primary response immediately for secondary backends to check
|
// Signal primary response immediately for secondary backends to check
|
||||||
if b.Role == "primary" && resp.StatusCode < 400 {
|
if b.Role == "primary" && resp.StatusCode < 400 {
|
||||||
@@ -1433,6 +1434,7 @@ func handleRequest(w http.ResponseWriter, r *http.Request, backends []Backend, c
|
|||||||
} else {
|
} else {
|
||||||
// Not the winning response, need to drain and close the body
|
// Not the winning response, need to drain and close the body
|
||||||
io.Copy(io.Discard, resp.Body)
|
io.Copy(io.Discard, resp.Body)
|
||||||
|
resp.Body.Close()
|
||||||
}
|
}
|
||||||
}(backend)
|
}(backend)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user