fix(chainwatch): Backoff processor when no work exists to process

This commit is contained in:
Mike Greenberg 2020-07-16 10:46:44 -04:00
parent f2f797f088
commit 7bfcff2c18

View File

@ -102,6 +102,12 @@ func (p *Processor) Start(ctx context.Context) {
log.Fatalw("Failed to get unprocessed blocks", "error", err) 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 // 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. // before doing "normal" processing.