func TimerAction(ctx context.Context, action func()) *time.Timer { t := time.NewTimer(0) t.Stop() go func() { for { select { case <-t.C: action() case <-ctx.Done(): t.Stop() return } } }() return t }