Skip to content

Commit

Permalink
(SDI-1827): Fix intelsdi-x#1128 Loading collector twice causes task f…
Browse files Browse the repository at this point in the history
…ailure
  • Loading branch information
marcin-krolik committed Oct 13, 2016
1 parent e72f01e commit 412a0d3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions control/plugin_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,16 @@ func (p *pluginManager) LoadPlugin(details *pluginDetails, emitter gomit.Emitter
return nil, serror.New(err)
}

// check if plugin is already loaded
key := fmt.Sprintf("%s"+core.Separator+"%s"+core.Separator+"%d", resp.Meta.Type.String(), resp.Meta.Name, resp.Meta.Version)
if _, exists := p.loadedPlugins.table[key]; exists {
return nil, serror.New(ErrPluginAlreadyLoaded, map[string]interface{}{
"plugin-name": resp.Meta.Name,
"plugin-version": resp.Meta.Version,
"plugin-type": resp.Type.String(),
})
}

ap, err := newAvailablePlugin(resp, emitter, ePlugin)
if err != nil {
pmLogger.WithFields(log.Fields{
Expand Down

0 comments on commit 412a0d3

Please sign in to comment.