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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user