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

Register Subscribers After Node Is Synced #7468

Merged
merged 12 commits into from
Oct 10, 2020
Merged

Register Subscribers After Node Is Synced #7468

merged 12 commits into from
Oct 10, 2020

Conversation

nisdas
Copy link
Member

@nisdas nisdas commented Oct 8, 2020

What type of PR is this?

Feature Addition

What does this PR do? Why is it needed?

As part of #6622 , we will need to enable gossip scoring. However gossip peer scoring relies on unsynced nodes staying out
of the mesh until they are synced. This PR registers the relevant subscribers later, and only joins the mesh for the relevant topics after the node is synced.

Which issues(s) does this PR fix?

N.A

Other notes for review

@nisdas nisdas requested a review from a team as a code owner October 8, 2020 15:49
@nisdas nisdas added Sync Sync (regular, initial, checkpoint) related issues In Progress labels Oct 8, 2020
Comment on lines 269 to 270
// Exit once we received the synced event.
stateSub.Unsubscribe()
Copy link
Contributor

@farazdagi farazdagi Oct 8, 2020

Choose a reason for hiding this comment

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

When you return, deferred stateSub.Unsubscribe() will be called.
I guess there is double unsubscribe in the original implementation as well?

@farazdagi
Copy link
Contributor

Nishant, per your request to pre-review: except for that double unsubscribe (which, I guess, is a no-op, on the second invocation) everything looks solid.

@nisdas nisdas added Ready For Review A pull request ready for code review and removed In Progress labels Oct 9, 2020
@codecov
Copy link

codecov bot commented Oct 9, 2020

Codecov Report

Merging #7468 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #7468   +/-   ##
=======================================
  Coverage   60.65%   60.65%           
=======================================
  Files         426      426           
  Lines       30384    30384           
=======================================
  Hits        18430    18430           
  Misses       8954     8954           
  Partials     3000     3000           

}
log.WithField("starttime", startTime).Debug("Chain started in sync service")
s.chainStarted = true
}()
Copy link
Member

Choose a reason for hiding this comment

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

Do you need to return after this go routine? Otherwise it's still in the for loop, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

We need it to continue looping as we also need to receive the synced event before
exiting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review Sync Sync (regular, initial, checkpoint) related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants