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

node: improve node state and lifecycle management #4653

Open
dshulyak opened this issue Jul 6, 2023 · 0 comments
Open

node: improve node state and lifecycle management #4653

dshulyak opened this issue Jul 6, 2023 · 0 comments

Comments

@dshulyak
Copy link
Contributor

dshulyak commented Jul 6, 2023

  • working with node requires access to private fields (signer and wait group)
  • additionally there is a mess with lifecycle, it accepts context and Start blocks on it, but in order to wait you have to call Cleanup and then wait on private error group
/* Create or load miner identity */
				if app.edSgn, err = app.LoadOrCreateEdSigner(); err != nil {
					return fmt.Errorf("could not retrieve identity: %w", err)
				}

				if err := app.LoadCheckpoint(ctx); err != nil {
					return err
				}

				if err := app.Initialize(); err != nil {
					return err
				}
				// This blocks until the context is finished or until an error is produced
				err = app.Start(ctx)

				cleanupCtx, cleanupCancel := context.WithTimeout(context.Background(), 30*time.Second)
				defer cleanupCancel()
				done := make(chan struct{}, 1)
				// FIXME: per https://github.com/spacemeshos/go-spacemesh/issues/3830
				go func() {
					app.Cleanup(cleanupCtx)
					_ = app.eg.Wait()
					close(done)
				}()
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Dev team kanban Jul 6, 2023
@fasmat fasmat self-assigned this Feb 24, 2024
@fasmat fasmat moved this from 📋 Backlog to 🏗 Doing in Dev team kanban Feb 24, 2024
@fasmat fasmat moved this from 🏗 Doing to 🔖 Next in Dev team kanban Mar 25, 2024
@fasmat fasmat removed their assignment Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔖 Next
2 participants