Rework servers load-balancer to use the WRR
Co-authored-by: Kevin Pollet <pollet.kevin@gmail.com>
This commit is contained in:
parent
67d9c8da0b
commit
fadee5e87b
70 changed files with 2085 additions and 2211 deletions
|
@ -23,17 +23,12 @@ type responseModifier struct {
|
|||
|
||||
// modifier can be nil.
|
||||
func newResponseModifier(w http.ResponseWriter, r *http.Request, modifier func(*http.Response) error) http.ResponseWriter {
|
||||
rm := &responseModifier{
|
||||
return &responseModifier{
|
||||
req: r,
|
||||
rw: w,
|
||||
modifier: modifier,
|
||||
code: http.StatusOK,
|
||||
}
|
||||
|
||||
if _, ok := w.(http.CloseNotifier); ok {
|
||||
return responseModifierWithCloseNotify{responseModifier: rm}
|
||||
}
|
||||
return rm
|
||||
}
|
||||
|
||||
func (r *responseModifier) WriteHeader(code int) {
|
||||
|
@ -97,12 +92,3 @@ func (r *responseModifier) Flush() {
|
|||
flusher.Flush()
|
||||
}
|
||||
}
|
||||
|
||||
type responseModifierWithCloseNotify struct {
|
||||
*responseModifier
|
||||
}
|
||||
|
||||
// CloseNotify implements http.CloseNotifier.
|
||||
func (r *responseModifierWithCloseNotify) CloseNotify() <-chan bool {
|
||||
return r.responseModifier.rw.(http.CloseNotifier).CloseNotify()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue