From 776f164e8207c1b9d6d893df74397299cba43d6a Mon Sep 17 00:00:00 2001 From: Matthias Loibl Date: Tue, 8 Aug 2017 14:38:31 +0200 Subject: [PATCH] Set the timeout for GitHub and Slack to 5s --- releasechecker.go | 4 +++- slack.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/releasechecker.go b/releasechecker.go index f62f746..d455df2 100644 --- a/releasechecker.go +++ b/releasechecker.go @@ -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 } diff --git a/slack.go b/slack.go index af1ab13..41cd842 100644 --- a/slack.go +++ b/slack.go @@ -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()