Skip to content
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

Change to local 'rng' instead of global 'rng' #62

Closed
wants to merge 2 commits into from
Closed

Change to local 'rng' instead of global 'rng' #62

wants to merge 2 commits into from

Conversation

philhofer
Copy link
Contributor

Fixes #61

@@ -800,6 +799,7 @@ func (r *Consumer) sendRDY(c *Conn, count int64) error {
}

func (r *Consumer) redistributeRDY() {
var rng = rand.New(rand.NewSource(time.Now().UnixNano()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the proposed fix @philhofer

I don't want a new rand source created each time redistributeRDY is called. It can actually use the same one you've created in rdyLoop on line 619, just pass it into this function...

@philhofer
Copy link
Contributor Author

Cool - changes reflected in 3f1673e

@mreiferson
Copy link
Member

great, thanks.

Mind squashing?

@mreiferson mreiferson added the bug label Jul 9, 2014
@mreiferson
Copy link
Member

n/m merged in 73464c2

@mreiferson mreiferson closed this Jul 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data race: 'rng' is not threadsafe
2 participants