mirror of
https://github.com/navidrome/navidrome.git
synced 2026-04-28 03:19:38 +00:00
fix(plugins): clear plugin errors on startup to allow retrying
Plugins that entered an error state (e.g., incompatible with the Navidrome version) would remain in that state across restarts, blocking the user from retrying. This adds a ClearErrors method to PluginRepository that resets the last_error field on all plugins, and calls it during plugin manager startup before syncing and loading. Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
d004f99f8f
commit
27a83547f7
5 changed files with 53 additions and 0 deletions
|
|
@ -29,6 +29,20 @@ func (m *MockPluginRepo) SetError(err bool) {
|
|||
m.Err = err
|
||||
}
|
||||
|
||||
func (m *MockPluginRepo) ClearErrors() error {
|
||||
if m.Err {
|
||||
return errors.New("unexpected error")
|
||||
}
|
||||
for i := range m.All {
|
||||
m.All[i].LastError = ""
|
||||
}
|
||||
for k, p := range m.Data {
|
||||
p.LastError = ""
|
||||
m.Data[k] = p
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MockPluginRepo) SetData(plugins model.Plugins) {
|
||||
m.Data = make(map[string]*model.Plugin, len(plugins))
|
||||
m.All = plugins
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue