You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running staticcheck over fargo reveals one potential problem: in file rpc.go's netReq function, when a request fails with a temporary error, we sleep for ten nanoseconds. Note that the magnitude is specified without any unit, allowing its conversion to a time.Duration with the default unit of nanoseconds.
% staticcheck
[...]/github.com/hudl/fargo/rpc.go:111:15: sleeping for 10 nanoseconds is probably a bug. Be explicit if it isn't: time.Sleep(10 * time.Nanosecond) (SA1004)
Oh, whoops. I think I intended 10 seconds, but that may be too long. A smarter option would probably be to back off, trying first 3 seconds later, then 9, then 30 or so.
I agree. There are various backoff libraries out there, if you'd consider introducing a dependency for this. Otherwise, I can implement a simple enough adjustment, so long as we limit how configurable it is. These things tend to devolve into a sampler pack of patterns—strategies, policies, and such.
Running staticcheck over fargo reveals one potential problem: in file rpc.go's
netReq
function, when a request fails with a temporary error, we sleep for ten nanoseconds. Note that the magnitude is specified without any unit, allowing its conversion to atime.Duration
with the default unit of nanoseconds.Error SA1004 has the following description:
What was the intended duration there? @ryansb added that statement in commit 4d053d5. Ryan, do you remember?
The text was updated successfully, but these errors were encountered: