slack-go / slack

Slack API in Go, originally by @nlopes; Maintainers needed, contact @parsley42
https://pkg.go.dev/github.com/slack-go/slack
BSD 2-Clause "Simplified" License
4.6k stars 1.11k forks source link

Custom http client Resty retry function does not work #1274

Open rts-gordon opened 3 months ago

rts-gordon commented 3 months ago

What happened

Custom http client Resty's retry function does not work with slack-go.

Expected behavior

Resty's retry function should works with slack-go.

Steps to reproduce

My program send message to Slack channel via slack-go. I use a custom http client Resty and set it to do retry 3 times, but it is not works with slack-go.

I called the Post method via Resty directly without slack-go, the retry function works well.

I changed to another http client retryablehttp, the retry function works well with slack-go.

Can you please take a look at this, thank you.

reproducible code

slack-go code:

// transfor resty.Client to http.Client
httpClient = InitHttpClient().GetClient()
slack.PostWebhookCustomHTTP(url, httpClient, &msg)

Resty httpClient:

func InitHttpClient() *resty.Client {
    return resty.New().
        SetRetryCount(3).
        SetRetryWaitTime(1 * time.Second).
        SetRetryMaxWaitTime(20 * time.Second)
}

Versions