1
0
Fork 0

Logger and Leaks

This commit is contained in:
Ludovic Fernandez 2018-02-12 17:24:03 +01:00 committed by Traefiker Bot
parent 91fa727c74
commit 38a4c80995
11 changed files with 108 additions and 82 deletions

View file

@ -34,17 +34,17 @@ func (r *ratioController) String() string {
}
func (r *ratioController) allowRequest() bool {
log.Infof("%v", r)
log.Debugf("%v", r)
t := r.targetRatio()
// This condition answers the question - would we satisfy the target ratio if we allow this request?
e := r.computeRatio(r.allowed+1, r.denied)
if e < t {
r.allowed++
log.Infof("%v allowed", r)
log.Debugf("%v allowed", r)
return true
}
r.denied++
log.Infof("%v denied", r)
log.Debugf("%v denied", r)
return false
}