update state from store before use in reactor

This commit is contained in:
William Banfield
2022-05-18 20:48:56 -04:00
parent c620900fdd
commit bff21bafbf
2 changed files with 4 additions and 4 deletions

View File

@@ -216,6 +216,10 @@ func (r *Reactor) OnStart(ctx context.Context) error {
if err := r.state.Start(ctx); err != nil {
return err
}
} else {
if err := r.state.updateStateFromStore(); err != nil {
return err
}
}
go r.updateRoundStateRoutine(ctx)

View File

@@ -248,9 +248,6 @@ func NewState(
}
func (cs *State) updateStateFromStore() error {
if cs.initialStatePopulated {
return nil
}
state, err := cs.stateStore.Load()
if err != nil {
return fmt.Errorf("loading state: %w", err)
@@ -266,7 +263,6 @@ func (cs *State) updateStateFromStore() error {
cs.updateToState(state)
cs.initialStatePopulated = true
return nil
}