From 200b0f72cc4a9b5d78085b24e9b69f139296764d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Tue, 11 Aug 2020 15:06:13 +0100 Subject: [PATCH] mpool/repub: only record in journal if actually repubbing. --- chain/messagepool/messagepool.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index c87a02b95..19856b9f7 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -371,17 +371,19 @@ func (mp *MessagePool) runLoop() { log.Errorf("errors while republishing: %+v", errout) } - journal.MaybeRecordEvent(mp.jrnl, mp.evtTypes[evtTypeMpoolRepub], func() interface{} { - msgs := make([]MessagePoolEvt_Message, 0, len(outputMsgs)) - for _, m := range outputMsgs { - msgs = append(msgs, MessagePoolEvt_Message{Message: m.Message, CID: m.Cid()}) - } - return MessagePoolEvt{ - Action: "repub", - Messages: msgs, - Error: errout, - } - }) + if len(outputMsgs) > 0 { + journal.MaybeRecordEvent(mp.jrnl, mp.evtTypes[evtTypeMpoolRepub], func() interface{} { + msgs := make([]MessagePoolEvt_Message, 0, len(outputMsgs)) + for _, m := range outputMsgs { + msgs = append(msgs, MessagePoolEvt_Message{Message: m.Message, CID: m.Cid()}) + } + return MessagePoolEvt{ + Action: "repub", + Messages: msgs, + Error: errout, + } + }) + } case <-mp.pruneTrigger: if err := mp.pruneExcessMessages(); err != nil {