diff --git a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go index 125e6c7d66..861daa3207 100644 --- a/pkg/plugins/plugins.go +++ b/pkg/plugins/plugins.go @@ -221,6 +221,10 @@ func loadWithRetry(name string, retry bool) (*Plugin, error) { } storage.Lock() + if pl, exists := storage.plugins[name]; exists { + storage.Unlock() + return pl, pl.activate() + } storage.plugins[name] = pl storage.Unlock() @@ -298,7 +302,10 @@ func GetAll(imp string) ([]*Plugin, error) { chPl := make(chan *plLoad, len(pluginNames)) var wg sync.WaitGroup for _, name := range pluginNames { - if pl, ok := storage.plugins[name]; ok { + storage.Lock() + pl, ok := storage.plugins[name] + storage.Unlock() + if ok { chPl <- &plLoad{pl, nil} continue }