fix: refresh mutations and defer busy quit
This commit is contained in:
@@ -153,6 +153,18 @@ func (a *Application) dispatch(intent Intent, publish func(Result)) Result {
|
||||
}
|
||||
defer unlock()
|
||||
}
|
||||
// A different process may have changed the persisted Active Profile since
|
||||
// this Application was constructed. Reload only after the global mutation
|
||||
// lock is held, before selecting a Profile or invoking a Target. Load is
|
||||
// deliberately separate from Store.Mutate so no Profile-store lock is nested.
|
||||
fresh, err := a.store.Load()
|
||||
if err != nil {
|
||||
return Result{Snapshot: a.Snapshot(), Err: fmt.Errorf("reload Profile state for mutation: %w", err)}
|
||||
}
|
||||
a.state = fresh
|
||||
if intent.Kind == SetTargetDesired || intent.Kind == ActivateProfile {
|
||||
a.refreshInspections()
|
||||
}
|
||||
if intent.Kind == SetTargetDesired {
|
||||
return a.setTargetDesired(intent)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user