adjust / rmq

Message queue system written in Go and backed by Redis
MIT License
1.57k stars 206 forks source link

Use default rand in jitteredDuration #118

Closed psampaz closed 2 years ago

psampaz commented 2 years ago

jitteredDuration introduced in https://github.com/adjust/rmq/pull/116 uses rand.NewSource which is not safe for concurrent use by multiple goroutines. https://github.com/golang/go/blob/8f53fad035ccc580859f7b063ae8be30b009a6be/src/math/rand/rand.go#L41

This PR updates jitterredDuration to use the default rand (the default Source is safe for concurrent use by multiple goroutines) which is already seeded in https://github.com/adjust/rmq/blob/master/rand.go#L9