From 01f80721e283086cd122879cb2c9f3bb95b274d7 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Fri, 16 Sep 2022 14:41:07 -0500 Subject: msgstore: post MessageInfo on erroneous fetch When errors occur during a fetch header request, the requested headers are deleted from pending and no information is given to the UI. Spinners keep spinning, and ultimately as the view is refreshed, the headers are fetched again. This can lead to infinite loops, and extremely long logs. Update the store with a MessageInfo message when an error is received. Have the UI display that the header couldn't be fetched in the message list. Signed-off-by: Tim Culverhouse Acked-by: Robin Jarry --- lib/format/format.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/format') diff --git a/lib/format/format.go b/lib/format/format.go index 42dd34a1..055e2c73 100644 --- a/lib/format/format.go +++ b/lib/format/format.go @@ -83,6 +83,10 @@ func ParseMessageFormat(format string, timeFmt string, thisDayTimeFmt string, thisWeekTimeFmt string, thisYearTimeFmt string, ctx Ctx) ( string, []interface{}, error, ) { + if ctx.MsgInfo.Error != nil { + return "", nil, + errors.New("(unable to fetch header)") + } retval := make([]byte, 0, len(format)) var args []interface{} -- cgit