From 2a1ae977a5e68439c97d47fe594d3a7514345166 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 26 Sep 2025 15:33:05 +0700 Subject: all: increase the worker HTTP client timeout Using 5 seconds timeout cause an error "context deadline exceeded" when sending notification on some instance of Mattermost. While at it, fix missing return statement on pushNotifMattermost. --- worker.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/worker.go b/worker.go index 007bc52..bccfe74 100644 --- a/worker.go +++ b/worker.go @@ -65,7 +65,7 @@ func newWorker(cfg ServerConfig) (wrk *worker, err error) { switch notifConfig.Kind { case notifKindMattermost: wrk.httpc = &http.Client{ - Timeout: 5 * time.Second, + Timeout: 10 * time.Second, } } } @@ -226,6 +226,7 @@ func (wrk *worker) pushNotifMattermost( resp, err = wrk.httpc.Do(req) if err != nil { log.Printf(`%s: %s`, logp, err) + return } if resp.StatusCode == 200 { @@ -236,6 +237,7 @@ func (wrk *worker) pushNotifMattermost( body, err = io.ReadAll(resp.Body) if err != nil { log.Printf(`%s: %s`, logp, err) + return } log.Printf(`%s: fail with status code %d: %s`, logp, resp.StatusCode, body) -- cgit v1.3