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

Database loading statuses #5405

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Database loading statuses #5405

wants to merge 2 commits into from

Conversation

jberci
Copy link
Contributor

@jberci jberci commented Oct 17, 2023

No description provided.

localStorage, err := NewLocalBackend(commonNode.Runtime.DataDir(), id)
if err != nil {
return fmt.Errorf("can't create local storage backend: %w", err)
storageCtor := func(ctx context.Context) (storageApi.LocalBackend, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why we don't create the local storage backend in committee/node? This would avoid passing in this factory function.

@@ -200,6 +202,31 @@ func NewNode(

n.ctx, n.ctxCancel = context.WithCancel(context.Background())

go func() {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't doing this async dangerous? Where do we ensure that start is not called before this completes? Related goroutines should probably block on a channel that gets closed once this deferred init completes?

if err != nil {
return nil, fmt.Errorf("can't create local storage backend: %w", err)
}
commonNode.Runtime.RegisterStorage(localStorage)
Copy link
Member

Choose a reason for hiding this comment

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

Are there any issues if this happens async?

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.

None yet

2 participants