package time_profile import "time" func newTimer() chan struct{} { ch := make(chan struct{}) go func(ch chan struct{}) { waitduration := 5000 * time.Millisecond timer := time.NewTimer(waitduration) for { select { case _ = <-ch: case <-timer.C: } timer.Reset(waitduration) } log.Info("Finished") }(ch) return ch }