0
0
mirror of https://github.com/thegeeklab/github-releases-notifier.git synced 2024-11-24 21:30:39 +00:00

Set the timeout for GitHub and Slack to 5s

This commit is contained in:
Matthias Loibl 2017-08-08 14:38:31 +02:00
parent d3177dbc2a
commit 776f164e82
No known key found for this signature in database
GPG Key ID: B1C7DF661ABB2C1A
2 changed files with 4 additions and 2 deletions

View File

@ -98,7 +98,9 @@ func (c *Checker) query(owner, name string) (Repository, error) {
"name": githubql.String(name),
}
if err := c.client.Query(context.Background(), &query, variables); err != nil {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if err := c.client.Query(ctx, &query, variables); err != nil {
return Repository{}, err
}

View File

@ -45,7 +45,7 @@ func (s *SlackSender) Send(repository Repository) error {
if err != nil {
return err
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
req = req.WithContext(ctx)
defer cancel()