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

[Stream] added stream downloader to consensus #3586

Merged
merged 2 commits into from
Mar 16, 2021

Conversation

JackyWYX
Copy link
Contributor

@JackyWYX JackyWYX commented Mar 13, 2021

Description

This is a break down of #3535, and is on top of #3587.

Added stream downloader to consensus. Now consensus will trigger new downloader logic only if downloader is setup.

consensus/downloader.go Outdated Show resolved Hide resolved
consensus.dHelper.d.DownloadAsync()
consensus.current.SetMode(Syncing)
for _, v := range consensus.consensusTimeout {
v.Stop()
Copy link
Contributor

Choose a reason for hiding this comment

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

will the timer be reset when the sync is finished?

Copy link
Contributor Author

@JackyWYX JackyWYX Mar 16, 2021

Choose a reason for hiding this comment

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

The timer is restarted in consensus.Start()

// consensus/consensus_v2.go:346
case <-consensus.syncReadyChan:
   ...
   consensus.consensusTimeout[timeoutConsensus].Start()

I currently did not refactor this part of code because:

  1. Both legacy sync and stream sync touches this part logic.
  2. I want to minimize the interface change related to existing consensus logic when adding new feature.

Probably this piece of code can be better refactored when DNS sync is fully removed. Added TODO. Thanks for bring this up.

@rlan35 rlan35 merged commit 1699ff7 into harmony-one:main Mar 16, 2021
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