From 737c30c19d43b12e132843d95f6250b216a9c215 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 12 Feb 2018 19:12:24 -0500 Subject: [PATCH] minor nit --- common/repeat_timer.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/common/repeat_timer.go b/common/repeat_timer.go index dba5fbadd..5d049738d 100644 --- a/common/repeat_timer.go +++ b/common/repeat_timer.go @@ -20,15 +20,17 @@ type Ticker interface { } //---------------------------------------- -// defaultTickerMaker +// defaultTicker + +var _ Ticker = (*defaultTicker)(nil) + +type defaultTicker time.Ticker func defaultTickerMaker(dur time.Duration) Ticker { ticker := time.NewTicker(dur) return (*defaultTicker)(ticker) } -type defaultTicker time.Ticker - // Implements Ticker func (t *defaultTicker) Chan() <-chan time.Time { return t.C @@ -151,12 +153,13 @@ func NewRepeatTimerWithTickerMaker(name string, dur time.Duration, tm TickerMake return t } +// receive ticks on ch, send out on t.ch func (t *RepeatTimer) fireRoutine(ch <-chan time.Time, quit <-chan struct{}) { for { select { - case t_ := <-ch: + case tick := <-ch: select { - case t.ch <- t_: + case t.ch <- tick: case <-quit: return }