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

chore(dot/peerset): remove the time.Sleep() dependency. #2785

Closed
wants to merge 2 commits into from

Conversation

axaysagathiya
Copy link
Contributor

@axaysagathiya axaysagathiya commented Aug 25, 2022

Changes

removed time.Sleep() dependency by using sync.WaitGroup in dot/peerset/peerset_test.go

Tests

go test github.com/ChainSafe/gossamer/dot/peerset

Issues

#2520

Primary Reviewer

@timwu20

@axaysagathiya axaysagathiya changed the title remove the time.Sleep() dependency from dot/peerset/peerset_test.go chore(dot/peerset): remove the time.Sleep() dependency. Aug 25, 2022
Comment on lines +85 to +90
waitGroup.Add(1)
go func() {
handler.AddReservedPeer(testSetID, peerID)
waitGroup.Done()
}()
waitGroup.Wait()
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't do anything (same as just handler.AddReservedPeer(testSetID, peerID))

I think we want to wait for a fire-and-forget goroutine launched within AddReservedPeer, so that would require a refactor of the production code of the method AddReservedPeer. Just a wild guess though, I haven't really digged into that method either.

Same comment for the other changes.

Parallel programming is hard too, so take it easy 😉

@qdm12 qdm12 marked this pull request as draft September 14, 2022 18:58
@qdm12
Copy link
Contributor

qdm12 commented Sep 14, 2022

Converting this back to draft until changes are made. Feel free to un-draft once it's done.

@axaysagathiya axaysagathiya deleted the issue-2520 branch July 21, 2023 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants