MM-2276: Fix flaky TestPlugin in cmd/mattermost/commands (#14064)

There was a race in (*App).SyncPlugins where if the same plugin
existed in availablePlugins and pluginSignaturePathMap, then
we would try to add/remove at the same time.

This would lead to a possible removal / addition of a plugin directory
or even unable to remove a directory because it was already in use.

We fix this by first finishing the removal of availablePlugins
before syncing it with the file store.
Этот коммит содержится в:
Agniva De Sarker
2020-03-17 21:26:59 +05:30
коммит произвёл GitHub
родитель dd0b0a3d67
Коммит d0d6125541
2 изменённых файлов: 13 добавлений и 6 удалений

Просмотреть файл

@@ -230,6 +230,7 @@ func (a *App) SyncPlugins() *model.AppError {
}
}(plugin.Manifest.Id)
}
wg.Wait()
// Install plugins from the file store.
pluginSignaturePathMap, appErr := a.getPluginsFromFolder()
@@ -263,7 +264,6 @@ func (a *App) SyncPlugins() *model.AppError {
mlog.Error("Failed to sync plugin from file store", mlog.String("bundle", plugin.path), mlog.Err(err))
}
}(plugin)
}
wg.Wait()