-
Notifications
You must be signed in to change notification settings - Fork 96
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
Drop internalized random number generators in favor of math/rand/v2
#691
Conversation
// `rand.Rand` argument. | ||
func DurationBetween(rand *mathrand.Rand, lowerLimit, upperLimit time.Duration) time.Duration { | ||
return time.Duration(IntBetween(rand, int(lowerLimit), int(upperLimit))) | ||
func DurationBetween(lowerLimit, upperLimit time.Duration) time.Duration { |
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.
riverpro will need a bump to correspond with these internal API changes
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.
Makes sense. I'll send one over.
The service archetype and a number of functions internalized a random source because in Go, that used to be the only way that you could guarantee that a non-crypto generated was actually seeded. Go 1.22 introduced `math/rand/v2` which fixed that problem. Now that Go 1.21 support's been dropped, it's a nice clean up to move to the V2 package and get rid of random sources being passed around everywhere.
0abdef7
to
4ab0d46
Compare
Also added a changelog just because use of |
This is breaking the ability to embed RiverUI 0.6.0 since it still accesses |
@sallam-dev sorry about that, fix & new release for riverui coming shortly! |
Follows up [1] to move to `math/rand/v2`, which automatically seeds itself, and away from the internal random source that came in with `baseservice.Archetype`. [1] riverqueue/river#691
@sallam-dev Just so I understand the breakage correctly ... River UI is still pointed to v0.14.2. Are you saying that the same app is pointing to both River and River UI, thereby getting upgraded to v0.14.3, and thus the breakage? |
Follows up [1] to move to `math/rand/v2`, which automatically seeds itself, and away from the internal random source that came in with `baseservice.Archetype`. [1] riverqueue/river#691
Exactly.. Our usecase involves embedding RiverUI while also using River in the same binary When upgrading River itself, the shared package got upgraded as well and I had to downgrade back to 0.14.2 to compile the project. |
Follows up [1] to move to `math/rand/v2`, which automatically seeds itself, and away from the internal random source that came in with `baseservice.Archetype`. [1] riverqueue/river#691
Okay thanks. It hadn't occurred to me before, but I guess the shared |
Follows up [1] to move to `math/rand/v2`, which automatically seeds itself, and away from the internal random source that came in with `baseservice.Archetype`. [1] riverqueue/river#691
Follows up [1] to move to `math/rand/v2`, which automatically seeds itself, and away from the internal random source that came in with `baseservice.Archetype`. [1] riverqueue/river#691
@sallam-dev Okay should be fixed as of riverqueue/riverui v0.7.0. |
Great! Thanks a ton! 🙏 |
…riverqueue#691) The service archetype and a number of functions internalized a random source because in Go, that used to be the only way that you could guarantee that a non-crypto generated was actually seeded. Go 1.22 introduced `math/rand/v2` which fixed that problem. Now that Go 1.21 support's been dropped, it's a nice clean up to move to the V2 package and get rid of random sources being passed around everywhere.
Just an incremental release with a couple small changes in riverqueue#690 and riverqueue#691. [skip ci]
Inverts links on #690 and #691 which currently point to each others pull requests instead of their own, as reported in [1]. [1] #688 (comment)
The service archetype and a number of functions internalized a random
source because in Go, that used to be the only way that you could
guarantee that a non-crypto generated was actually seeded.
Go 1.22 introduced
math/rand/v2
which fixed that problem. Now that Go1.21 support's been dropped, it's a nice clean up to move to the V2
package and get rid of random sources being passed around everywhere.