From e11e0eb32a4b13105fc1100716fc4a0a3c3b9ae6 Mon Sep 17 00:00:00 2001 From: vyzo Date: Thu, 16 Mar 2023 17:38:46 +0200 Subject: [PATCH] complain if head change processing is building backlog --- chain/index/msgindex.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chain/index/msgindex.go b/chain/index/msgindex.go index aa23b4e4d..16b47616f 100644 --- a/chain/index/msgindex.go +++ b/chain/index/msgindex.go @@ -290,9 +290,14 @@ func (x *msgIndex) onHeadChange(rev, app []*types.TipSet) error { // do it in the background to avoid blocking head change processing x.mx.Lock() x.pend = append(x.pend, headChange{rev: rev, app: app}) - // TODO log loudly if this is building backlog (it shouldn't but better be safe on this) + pendLen := len(x.pend) x.mx.Unlock() + // complain loudly if this is building backlog + if pendLen > 10 { + log.Warnf("message index head change processing is building backlog: %d pending head changes", pendLen) + } + select { case x.sema <- struct{}{}: default: