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:
parent
d3177dbc2a
commit
776f164e82
@ -98,7 +98,9 @@ func (c *Checker) query(owner, name string) (Repository, error) {
|
|||||||
"name": githubql.String(name),
|
"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
|
return Repository{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
slack.go
2
slack.go
@ -45,7 +45,7 @@ func (s *SlackSender) Send(repository Repository) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
req = req.WithContext(ctx)
|
req = req.WithContext(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user