Skip to content

Commit

Permalink
increase http timeouts to 60 seconds for AfricasTalking, Hormuud toke…
Browse files Browse the repository at this point in the history
…n lasts 90 minutes
  • Loading branch information
nicpottier committed May 30, 2019
1 parent a03ee57 commit 4e30eb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions handlers/hormuud/hormuud.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ func (h *handler) FetchToken(ctx context.Context, channel courier.Channel, msg c
return "", rr, errors.Errorf("no access token returned")
}

// we got a token, cache it to redis with a 25 second expiration
// we got a token, cache it to redis with a 90 minute expiration
conn = h.Backend().RedisPool().Get()
_, err = conn.Do("SETEX", fmt.Sprintf("hm_token_%s", channel.UUID()), 25, token)
_, err = conn.Do("SETEX", fmt.Sprintf("hm_token_%s", channel.UUID()), 5340, token)
conn.Close()

if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions utils/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ func GetHTTPClient() *http.Client {
once.Do(func() {
transport = &http.Transport{
MaxIdleConns: 10,
IdleConnTimeout: 30 * time.Second,
IdleConnTimeout: 60 * time.Second,
}
client = &http.Client{
Transport: transport,
Timeout: 30 * time.Second,
Timeout: 60 * time.Second,
}
})

Expand All @@ -170,12 +170,12 @@ func GetInsecureHTTPClient() *http.Client {
insecureOnce.Do(func() {
insecureTransport = &http.Transport{
MaxIdleConns: 10,
IdleConnTimeout: 30 * time.Second,
IdleConnTimeout: 60 * time.Second,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
insecureClient = &http.Client{
Transport: insecureTransport,
Timeout: 30 * time.Second,
Timeout: 60 * time.Second,
}
})

Expand Down

0 comments on commit 4e30eb0

Please sign in to comment.