From 7f27c80a6a620c181a574e50a9902c37f1255c71 Mon Sep 17 00:00:00 2001 From: vyzo Date: Sat, 15 Aug 2020 21:20:02 +0300 Subject: [PATCH] move sleep into the select as it is it simply slows down the writer if there are many messages --- cmd/lotus-chainwatch/processor/mpool.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/lotus-chainwatch/processor/mpool.go b/cmd/lotus-chainwatch/processor/mpool.go index ad75baddc..1f5826170 100644 --- a/cmd/lotus-chainwatch/processor/mpool.go +++ b/cmd/lotus-chainwatch/processor/mpool.go @@ -30,11 +30,10 @@ func (p *Processor) subMpool(ctx context.Context) { loop: for { - time.Sleep(10 * time.Millisecond) select { case update := <-sub: updates = append(updates, update) - default: + case <-time.After(10 * time.Millisecond): break loop } }