mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
inlet/core: correctly close new ticker on stop
This commit is contained in:
@@ -80,6 +80,7 @@ func (c *Component) Start() error {
|
||||
errLogger := c.r.Sample(reporter.BurstSampler(time.Minute, 10))
|
||||
|
||||
c.t.Go(func() error {
|
||||
defer ticker.Stop()
|
||||
ctx := c.t.Context(context.Background())
|
||||
templateCount := 0
|
||||
transmit := func(kind string, payloads <-chan []byte) {
|
||||
@@ -93,7 +94,6 @@ func (c *Component) Start() error {
|
||||
}
|
||||
}
|
||||
}
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-c.t.Dying():
|
||||
|
||||
@@ -33,7 +33,9 @@ func (c *Component) FlowsHTTPHandler(gc *gin.Context) {
|
||||
|
||||
// Flush from time to time
|
||||
var tickerChan <-chan time.Time
|
||||
tickerChan = time.NewTicker(c.httpFlowFlushDelay).C
|
||||
ticker := time.NewTicker(c.httpFlowFlushDelay)
|
||||
tickerChan = ticker.C
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user