Skip to content

Commit

Permalink
notifier: add a timeout on the http client
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin-M authored and jzelinskie committed Feb 24, 2016
1 parent 274a162 commit 904ce60
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions notifier/notifiers/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
"time"

"gopkg.in/yaml.v2"

Expand All @@ -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
Expand Down Expand Up @@ -89,6 +92,7 @@ func (h *WebhookNotifier) Configure(config *config.NotifierConfig) (bool, error)
Transport: &http.Transport{
TLSClientConfig: tlsConfig,
},
Timeout: timeout,
}
return true, nil
}
Expand Down

0 comments on commit 904ce60

Please sign in to comment.