mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-20 20:39:08 +02:00
Code cleaning in updateState
This commit is contained in:
@@ -262,15 +262,18 @@ func (u *UpdateManager) handleUpdate(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *UpdateManager) updateStateManager(ctx context.Context) {
|
func (u *UpdateManager) updateStateManager(ctx context.Context) {
|
||||||
u.stateManager.RegisterState(&UpdateState{})
|
var stateType *UpdateState
|
||||||
if err := u.stateManager.LoadState(&UpdateState{}); err != nil {
|
|
||||||
|
u.stateManager.RegisterState(stateType)
|
||||||
|
if err := u.stateManager.LoadState(stateType); err != nil {
|
||||||
log.Errorf("failed to load state: %v", err)
|
log.Errorf("failed to load state: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
state := u.stateManager.GetState(&UpdateState{})
|
state := u.stateManager.GetState(stateType)
|
||||||
if state == nil {
|
if state == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
updateState, ok := state.(*UpdateState)
|
updateState, ok := state.(*UpdateState)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Errorf("failed to cast state to UpdateState")
|
log.Errorf("failed to cast state to UpdateState")
|
||||||
|
|||||||
Reference in New Issue
Block a user