dont create a new ticker each loop
Jeromy committed
May 1, 2015 at 23:11 UTC
867186c05486f256bc4b07a7c1fed46a04727658
1 file changed
+2
-1
exchange/bitswap/workers.go
+2
-1
@@ -182,10 +182,11 @@ func (bs *Bitswap) rebroadcastWorker(parent context.Context) {
182
defer cancel()
183
184
broadcastSignal := time.After(rebroadcastDelay.Get())
185
+ tick := time.Tick(10 * time.Second)
186
187
for {
188
select {
188
- case <-time.Tick(10 * time.Second):
189
+ case <-tick:
190
n := bs.wantlist.Len()
191
if n > 0 {
192
log.Debug(n, inflect.FromNumber("keys", n), "in bitswap wantlist")