Skip to content

Commit

Permalink
do not use errchan
Browse files Browse the repository at this point in the history
  • Loading branch information
poblahblahblah committed Sep 9, 2017
1 parent 4501ecb commit d204a2f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions plugins/inputs/nginx_plus/nginx_plus.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"time"

"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal/errchan"
"github.com/influxdata/telegraf/plugins/inputs"
)

Expand All @@ -36,23 +35,22 @@ func (n *NginxPlus) Description() string {

func (n *NginxPlus) Gather(acc telegraf.Accumulator) error {
var wg sync.WaitGroup
errChan := errchan.New(len(n.Urls))

for _, u := range n.Urls {
addr, err := url.Parse(u)
if err != nil {
return fmt.Errorf("Unable to parse address '%s': %s", u, err)
acc.AddError(fmt.Errorf("Unable to parse address '%s': %s", u, err))
}

wg.Add(1)
go func(addr *url.URL) {
defer wg.Done()
errChan.C <- n.gatherUrl(addr, acc)
acc.AddError(n.gatherUrl(addr, acc))
}(addr)
}

wg.Wait()
return errChan.Error()
return nil
}

var tr = &http.Transport{
Expand Down

0 comments on commit d204a2f

Please sign in to comment.