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)
go func() {
t := time.NewTicker(time.Minute)
defer t.Stop()
for {
select {
case <-ch: