fix: secure profile persistence ownership
This commit is contained in:
@@ -77,6 +77,19 @@ func (a *Application) Dispatch(intent Intent) Result {
|
||||
})
|
||||
if err == nil {
|
||||
a.state = next
|
||||
} else {
|
||||
var committed *profile.CommitError
|
||||
if errors.As(err, &committed) {
|
||||
// Rename committed next before directory durability reporting failed.
|
||||
// Prefer that state even if the required verification reload also fails.
|
||||
a.state = next
|
||||
reloaded, loadErr := a.store.Load()
|
||||
if loadErr != nil {
|
||||
err = errors.Join(err, fmt.Errorf("reload committed Profile configuration: %w", loadErr))
|
||||
} else {
|
||||
a.state = reloaded
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result{Snapshot: a.Snapshot(), Notice: notice, Err: err}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user