From 4411c45cd5bed9bd3374fbbca09764ac012bff66 Mon Sep 17 00:00:00 2001 From: Siyuan Date: Fri, 14 Nov 2025 12:04:22 +0000 Subject: [PATCH] fix: defer updating state update to after update is complete --- internal/ota/ota.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/ota/ota.go b/internal/ota/ota.go index 1ea6a356..095fec40 100644 --- a/internal/ota/ota.go +++ b/internal/ota/ota.go @@ -137,10 +137,6 @@ func (s *State) doUpdate(ctx context.Context, params UpdateParams) error { if !params.CheckOnly { s.updating = true s.triggerStateUpdate() - defer func() { - s.updating = false - s.triggerStateUpdate() - }() } appUpdate, systemUpdate, err := s.getUpdateStatus(ctx, params) @@ -152,6 +148,8 @@ func (s *State) doUpdate(ctx context.Context, params UpdateParams) error { s.triggerStateUpdate() if params.CheckOnly { + s.updating = false + s.triggerStateUpdate() return nil }