提交 a6a64526 作者: Brian Tiger Chow

fix(blockservice/worker) replace time.Tick with a timer we can stop

上级 e3c9f6db
......@@ -84,6 +84,8 @@ func (w *Worker) start(c Config) {
defer close(workerChan)
var workQueue BlockList
debugInfo := time.NewTicker(5 * time.Second)
defer debugInfo.Stop()
for {
// take advantage of the fact that sending on nil channel always
......@@ -99,7 +101,7 @@ func (w *Worker) start(c Config) {
// if worker is ready and there's a block to process, send the
// block
case sendToWorker <- nextBlock:
case <-time.Tick(5 * time.Second):
case <-debugInfo.C:
if workQueue.Len() > 0 {
log.Debugf("%d blocks in blockservice provide queue...", workQueue.Len())
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论