From 7bfcff2c186c082bbfbc6b4c0f3377f6857f1a5f Mon Sep 17 00:00:00 2001 From: Mike Greenberg Date: Thu, 16 Jul 2020 10:46:44 -0400 Subject: [PATCH] fix(chainwatch): Backoff processor when no work exists to process --- cmd/lotus-chainwatch/processor/processor.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/lotus-chainwatch/processor/processor.go b/cmd/lotus-chainwatch/processor/processor.go index bf13d9389..1c6d78c3c 100644 --- a/cmd/lotus-chainwatch/processor/processor.go +++ b/cmd/lotus-chainwatch/processor/processor.go @@ -102,6 +102,12 @@ func (p *Processor) Start(ctx context.Context) { log.Fatalw("Failed to get unprocessed blocks", "error", err) } + if len(toProcess) == 0 { + log.Debugw("No unprocessed blocks. Wait then try again...") + time.Sleep(time.Second * 10) + continue + } + // TODO special case genesis state handling here to avoid all the special cases that will be needed for it else where // before doing "normal" processing.