notifier: add a timeout on the http client
This commit is contained in:
parent
274a1620a5
commit
904ce6004f
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user