Radar is heavily rate limiting due to bot scraping. We could help API consumers with this.
#28 is a first start.
I am testing https://github.com/hashicorp/go-retryablehttp atm and have a patch:
package web
import (
"net/http"
"time"
"github.com/hashicorp/go-retryablehttp"
)
func GetHttpClient() *http.Client {
retryClient := retryablehttp.NewClient()
retryClient.RetryMax = 10
httpClient := retryClient.StandardClient()
httpClient.Timeout = 30 * time.Second
return httpClient
}
Which I use like so:
radarClient := radarPkg.NewRadarClient(
radarPkg.WithLogger(slogHandler),
radarPkg.WithClient(httpClient),
)
I am not sure if we should make the decision for people what client they should use but it might save work? OTOH, they'll probably want to configure the retryablehttp client also. So, I am not sure what is best. Documenting this approach could also be fine?
Radar is heavily rate limiting due to bot scraping. We could help API consumers with this.
#28 is a first start.
I am testing https://github.com/hashicorp/go-retryablehttp atm and have a patch:
Which I use like so:
I am not sure if we should make the decision for people what client they should use but it might save work? OTOH, they'll probably want to configure the
retryablehttpclient also. So, I am not sure what is best. Documenting this approach could also be fine?