Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Fixes #1450 - check publish response for error
Browse files Browse the repository at this point in the history
  • Loading branch information
jcooklin committed Dec 23, 2016
1 parent 702d12b commit 9694f0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 2 additions & 5 deletions control/available_plugin.go
Expand Up @@ -441,12 +441,10 @@ func (ap *availablePlugins) collectMetrics(pluginKey string, metricTypes []core.
}

func (ap *availablePlugins) publishMetrics(metrics []core.Metric, pluginName string, pluginVersion int, config map[string]ctypes.ConfigValue, taskID string) []error {
var errs []error
key := strings.Join([]string{plugin.PublisherPluginType.String(), pluginName, strconv.Itoa(pluginVersion)}, core.Separator)
pool, serr := ap.getPool(key)
if serr != nil {
errs = append(errs, serr)
return errs
return []error{serr}
}
if pool == nil {
return []error{serror.New(ErrPoolNotFound, map[string]interface{}{"pool-key": key})}
Expand All @@ -457,8 +455,7 @@ func (ap *availablePlugins) publishMetrics(metrics []core.Metric, pluginName str

p, err := pool.SelectAP(taskID, config)
if err != nil {
errs = append(errs, err)
return errs
return []error{serr}
}

cli, ok := p.(*availablePlugin).client.(client.PluginPublisherClient)
Expand Down
5 changes: 4 additions & 1 deletion control/plugin/client/grpc.go
Expand Up @@ -193,10 +193,13 @@ func (g *grpcClient) Publish(metrics []core.Metric, config map[string]ctypes.Con
Metrics: NewMetrics(metrics),
Config: ToConfigMap(config),
}
_, err := g.publisher.Publish(getContext(g.timeout), arg)
reply, err := g.publisher.Publish(getContext(g.timeout), arg)
if err != nil {
return err
}
if reply.Error != "" {
return errors.New(reply.Error)
}
return nil
}

Expand Down

0 comments on commit 9694f0d

Please sign in to comment.