rollbar / terraform-provider-rollbar

Terraform provider for Rollbar
https://rollbar.com
MIT License
28 stars 13 forks source link

added tries and incremental delay #321

Closed pawelsz-rb closed 1 year ago

pawelsz-rb commented 1 year ago

Description of the change

Added 5 tries with incremental delay.

resty-go is using backoff method to increase retry intervals after each attempt. I think it's good enough for us, and it saves the development time.

Here are my 3 delay benchmarks using 8 seconds as the start, and 50 seconds as the max:

1:18PM DBG Users/pawel/go/pkg/mod/github.com/rs/zerolog@v1.20.0/log.go:390 > 8.001985834s
1:18PM DBG Users/pawel/go/pkg/mod/github.com/rs/zerolog@v1.20.0/log.go:390 > 13.578360833s
1:18PM DBG Users/pawel/go/pkg/mod/github.com/rs/zerolog@v1.20.0/log.go:390 > 22.769034625s
1:18PM DBG Users/pawel/go/pkg/mod/github.com/rs/zerolog@v1.20.0/log.go:390 > 38.384722458s

1:21PM DBG Users/pawel/go/pkg/mod/github.com/rs/zerolog@v1.20.0/log.go:390 > 8.002051416s
1:21PM DBG Users/pawel/go/pkg/mod/github.com/rs/zerolog@v1.20.0/log.go:390 > 11.219837459s
1:21PM DBG Users/pawel/go/pkg/mod/github.com/rs/zerolog@v1.20.0/log.go:390 > 21.410728333s
1:21PM DBG Users/pawel/go/pkg/mod/github.com/rs/zerolog@v1.20.0/log.go:390 > 39.316473042s

1:26PM DBG Users/pawel/go/pkg/mod/github.com/rs/zerolog@v1.20.0/log.go:390 > 8.001550333s
1:26PM DBG Users/pawel/go/pkg/mod/github.com/rs/zerolog@v1.20.0/log.go:390 > 15.233538917s
1:26PM DBG Users/pawel/go/pkg/mod/github.com/rs/zerolog@v1.20.0/log.go:390 > 19.549524041s
1:26PM DBG Users/pawel/go/pkg/mod/github.com/rs/zerolog@v1.20.0/log.go:390 > 47.789060292s

I think it's good enough and really close to what we agreed

in addition, I have set additional timeout for http client (30 seconds).

That way it will give us plenty of time to recover. Also I don't want to recover errors yet (returning success in case of failure). Let'e see first if this change will help.

Type of change

Related issues

Shortcut stories and GitHub issues (delete irrelevant)

Checklists

Development

Code review

pawelsz-rb commented 1 year ago

Can we add some tests for a situation where we end up with retries?

imo, I don't think it's needed, because this is internal feature of resty-go and it's fully tested here: https://github.com/go-resty/resty/blob/master/resty_test.go#L71 and here https://github.com/go-resty/resty/blob/master/retry_test.go#L209

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 1.8.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: