Skip to content

Commit

Permalink
add timeout to webhook sender
Browse files Browse the repository at this point in the history
  • Loading branch information
cainlevy committed Jun 8, 2020
1 parent e1b22d8 commit 31c935b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## HEAD

### Fixed

* added a timeout to webhook sender

## 1.10.0

### Added
Expand Down
6 changes: 5 additions & 1 deletion app/services/webhook_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ func WebhookSender(destination *url.URL, values *url.Values, schedule []time.Dur
return fmt.Errorf("URL unconfigured")
}

c := &http.Client{
Timeout: 10 * time.Second,
}

err := retry(schedule, func() error {
res, err := http.PostForm(destination.String(), *values)
res, err := c.PostForm(destination.String(), *values)
if err == nil && res.StatusCode > 299 {
return fmt.Errorf("Status Code: %v", res.StatusCode)
}
Expand Down

0 comments on commit 31c935b

Please sign in to comment.