notifier: add a timeout on the http client

This commit is contained in:
Quentin Machu 2016-02-22 16:38:16 -05:00 committed by Jimmy Zelinskie
parent 274a1620a5
commit 904ce6004f

View File

@ -25,6 +25,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
"time"
"gopkg.in/yaml.v2"
@ -33,6 +34,8 @@ import (
"github.com/coreos/clair/notifier"
)
const timeout = 5 * time.Second
// A WebhookNotifier dispatches notifications to a webhook endpoint.
type WebhookNotifier struct {
endpoint string
@ -89,6 +92,7 @@ func (h *WebhookNotifier) Configure(config *config.NotifierConfig) (bool, error)
Transport: &http.Transport{
TLSClientConfig: tlsConfig,
},
Timeout: timeout,
}
return true, nil
}