-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix data race #492
Fix data race #492
Conversation
We were seeing intermittent data race failures in our unit tests. This backoff implementation is advertised as not thread safe so we need a new instance each time. https://github.com/cenkalti/backoff/blob/v4.2.0/tries.go#L10-L12
Damn, just noticed there are a few more occurrences that need fixing too. |
Codecov Report
@@ Coverage Diff @@
## main #492 +/- ##
===================================================
- Coverage 55.41085% 55.04615% -0.36470%
===================================================
Files 40 40
Lines 3225 3250 +25
===================================================
+ Hits 1787 1789 +2
- Misses 1293 1324 +31
+ Partials 145 137 -8
Continue to review full report at Codecov.
|
Ok fixed all of them now 👍 |
clients/input_copy.go
Outdated
@@ -155,3 +153,7 @@ type StubInputCopy struct{} | |||
func (s *StubInputCopy) CopyInputToS3(requestID string, inputFile, osTransferURL *url.URL) (inputVideoProbe video.InputVideo, signedURL string, err error) { | |||
return video.InputVideo{}, "", nil | |||
} | |||
|
|||
func RetryBackoff() backoff.BackOff { | |||
return backoff.WithMaxRetries(newExponentialBackOffExecutor(), 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to create two functions for better readability?
func RetryExponentialBackoff()
and func RetryConstantBackoff()
We were seeing intermittent data race failures in our unit tests. This backoff implementation is advertised as not thread safe so we need a new instance each time. https://github.com/cenkalti/backoff/blob/v4.2.0/tries.go#L10-L12