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

fix(service/header): lazily load Store head #458

Merged
merged 4 commits into from
Feb 17, 2022
Merged

Conversation

Wondertan
Copy link
Member

@Wondertan Wondertan commented Feb 17, 2022

Fixes #457 by making store head being lazy loaded and not on Start.

@Wondertan Wondertan added the area:header Extended header label Feb 17, 2022
@Wondertan Wondertan self-assigned this Feb 17, 2022
liamsi
liamsi previously approved these changes Feb 17, 2022
service/header/store.go Show resolved Hide resolved
service/header/store.go Outdated Show resolved Hide resolved
@Wondertan
Copy link
Member Author

Wondertan commented Feb 17, 2022

The initialization flow:

  • 1 Node creates Store
  • 2 Node initializes Store
    • 2a Checks if there is any head
    • 2b If not - requests and writes requested head to Store
  • 3 Node starts Store

The bug was with the fact that step 2a required step 3, as Head was only loaded on start. Now that head is lazy-loaded, 2a can understand if there is head without 3

Co-authored-by: Ismail Khoffi <Ismail.Khoffi@gmail.com>
Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

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

🙏

Copy link
Member

@renaynay renaynay left a comment

Choose a reason for hiding this comment

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

MGMT

@Wondertan
Copy link
Member Author

@renaynay, yeah, nice band 😄

MGMT

@Wondertan Wondertan merged commit 814984e into main Feb 17, 2022
@Wondertan Wondertan deleted the hlib/store-fix-init branch May 14, 2022 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:header Extended header
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[BUG]: store is always initialized
3 participants