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
It's been awhile since I wrote this module and, looking at it again while making it an actual module, I note a glaring problem: it allows you to create a zero-value Retrier, whereupon it will panic:
Because, as we have seen before values <=0 passed to rand.Int63 will fail, and a zero-value Retrier is, unsurprisingly, filled with zeros.
Looking back on it, I can see what I was going for: I was attempting to force the user to create an object that could be messed with after instantiation, thus making it safe to use concurrently as generator at runtime. A good idea, but allowing a panic condition is a poor oversight that's easy to hit, since I just found myself attempting to do so, and others doubtless will as well. I think the simplest fix is to add the same default checks that are in place in the NewRetrier() method in the `RunContext()
The text was updated successfully, but these errors were encountered:
It's been awhile since I wrote this module and, looking at it again while making it an actual module, I note a glaring problem: it allows you to create a zero-value
Retrier
, whereupon it will panic:Results in
Because, as we have seen before values <=0 passed to
rand.Int63
will fail, and a zero-valueRetrier
is, unsurprisingly, filled with zeros.Looking back on it, I can see what I was going for: I was attempting to force the user to create an object that could be messed with after instantiation, thus making it safe to use concurrently as generator at runtime. A good idea, but allowing a panic condition is a poor oversight that's easy to hit, since I just found myself attempting to do so, and others doubtless will as well. I think the simplest fix is to add the same default checks that are in place in the
NewRetrier()
method in the `RunContext()The text was updated successfully, but these errors were encountered: