good morning!!!!

Skip to content
Snippets Groups Projects
Commit 75a82206 authored by Garet Halliday's avatar Garet Halliday
Browse files

hmmmmm

parent 06d425f5
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ func init() {
type Scorer struct {
Threshold caddy.Duration `json:"threshold"`
Validity caddy.Duration `json:"validity"`
}
func (T *Scorer) CaddyModule() caddy.ModuleInfo {
......@@ -31,11 +32,11 @@ func (T *Scorer) Score(conn *fed.Conn) (int, time.Duration, error) {
start := time.Now()
err, _ := backends.QueryString(conn, nil, "select 0")
if err != nil {
return 0, 10 * time.Second, err
return 0, time.Duration(T.Validity), err
}
dur := time.Since(start)
penalty := int(dur / time.Duration(T.Threshold))
return penalty, 10 * time.Second, nil
return penalty, time.Duration(T.Validity), nil
}
var _ pool.Scorer = (*Scorer)(nil)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment