|
|
@ -174,12 +174,13 @@ func (p *Pipeline) mergeproc(mirror bool, index int, ch <-chan *message) { |
|
|
|
closed bool |
|
|
|
closed bool |
|
|
|
count int |
|
|
|
count int |
|
|
|
inteval = p.config.Interval |
|
|
|
inteval = p.config.Interval |
|
|
|
oldTicker = true |
|
|
|
timeout = false |
|
|
|
) |
|
|
|
) |
|
|
|
if index > 0 { |
|
|
|
if index > 0 { |
|
|
|
inteval = xtime.Duration(int64(index) * (int64(p.config.Interval) / int64(p.config.Worker))) |
|
|
|
inteval = xtime.Duration(int64(index) * (int64(p.config.Interval) / int64(p.config.Worker))) |
|
|
|
} |
|
|
|
} |
|
|
|
ticker := time.NewTicker(time.Duration(inteval)) |
|
|
|
timer := time.NewTimer(time.Duration(inteval)) |
|
|
|
|
|
|
|
defer timer.Stop() |
|
|
|
for { |
|
|
|
for { |
|
|
|
select { |
|
|
|
select { |
|
|
|
case m = <-ch: |
|
|
|
case m = <-ch: |
|
|
@ -193,12 +194,8 @@ func (p *Pipeline) mergeproc(mirror bool, index int, ch <-chan *message) { |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
continue |
|
|
|
continue |
|
|
|
case <-ticker.C: |
|
|
|
case <-timer.C: |
|
|
|
if oldTicker { |
|
|
|
timeout = true |
|
|
|
ticker.Stop() |
|
|
|
|
|
|
|
ticker = time.NewTicker(time.Duration(p.config.Interval)) |
|
|
|
|
|
|
|
oldTicker = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
name := p.name |
|
|
|
name := p.name |
|
|
|
process := count |
|
|
|
process := count |
|
|
@ -215,8 +212,12 @@ func (p *Pipeline) mergeproc(mirror bool, index int, ch <-chan *message) { |
|
|
|
_metricChanLen.Set(float64(len(ch)), name, strconv.Itoa(index)) |
|
|
|
_metricChanLen.Set(float64(len(ch)), name, strconv.Itoa(index)) |
|
|
|
_metricCount.Add(float64(process), name, strconv.Itoa(index)) |
|
|
|
_metricCount.Add(float64(process), name, strconv.Itoa(index)) |
|
|
|
if closed { |
|
|
|
if closed { |
|
|
|
ticker.Stop() |
|
|
|
|
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if !timer.Stop() && !timeout { |
|
|
|
|
|
|
|
<-timer.C |
|
|
|
|
|
|
|
timeout = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
timer.Reset(time.Duration(p.config.Interval)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|