use custom http client for slack messages
This commit is contained in:
parent
69cfd7f798
commit
73228d1bfb
1 changed files with 15 additions and 0 deletions
|
@ -2,7 +2,10 @@ package util
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/lbryio/lbry.go/v2/extras/errors"
|
||||
|
||||
|
@ -61,6 +64,18 @@ func SendToSlack(format string, a ...interface{}) error {
|
|||
func sendToSlack(channel, username, message string) error {
|
||||
var err error
|
||||
|
||||
c := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).DialContext,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ResponseHeaderTimeout: 10 * time.Second,
|
||||
ExpectContinueTimeout: 1 * time.Second,
|
||||
},
|
||||
}
|
||||
slack.OptionHTTPClient(c)
|
||||
if slackApi == nil {
|
||||
err = errors.Err("no slack token provided")
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue