aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-09-26 15:33:05 +0700
committerShulhan <ms@kilabit.info>2025-09-26 15:33:22 +0700
commit2a1ae977a5e68439c97d47fe594d3a7514345166 (patch)
tree5794d663b06fc33884e4593d27c80be5c08d7f32
parentf2d8bde324132b86f68ea4b72868e3ff38d4bf51 (diff)
downloadlilin-2a1ae977a5e68439c97d47fe594d3a7514345166.tar.xz
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.
-rw-r--r--worker.go4
1 files changed, 3 insertions, 1 deletions
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)