Stop the ticker when goroutine exits

main
Max Ignatenko 2024-03-28 15:31:17 +00:00
parent 4556d6738a
commit 5d3d562ecc
1 changed files with 1 additions and 0 deletions

View File

@ -100,6 +100,7 @@ func (c *Consumer) runOnce(ctx context.Context) error {
defer close(ch) defer close(ch)
go func() { go func() {
t := time.NewTicker(time.Minute) t := time.NewTicker(time.Minute)
defer t.Stop()
for { for {
select { select {
case <-ch: case <-ch: