prevent potential tail datarace (#1254)

This commit is contained in:
Cameron Sparr 2016-05-24 15:16:33 +01:00
parent 475252d873
commit d736c7235a
1 changed files with 1 additions and 1 deletions

View File

@ -95,6 +95,7 @@ func (t *Tail) Start(acc telegraf.Accumulator) error {
continue
}
// create a goroutine for each "tailer"
t.wg.Add(1)
go t.receiver(tailer)
t.tailers = append(t.tailers, tailer)
}
@ -109,7 +110,6 @@ func (t *Tail) Start(acc telegraf.Accumulator) error {
// this is launched as a goroutine to continuously watch a tailed logfile
// for changes, parse any incoming msgs, and add to the accumulator.
func (t *Tail) receiver(tailer *tail.Tail) {
t.wg.Add(1)
defer t.wg.Done()
var m telegraf.Metric