From ad8c97c9bb24027349f9f7c3ab20f550cc2a3159 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Tue, 2 Nov 2021 18:50:41 -0400 Subject: [PATCH] CHATHISTORY with nonexistent msgid should send empty batch It was sending MESSAGE_ERROR, which was inappropriate. Send an empty batch for now (this is at parity with the in-memory implementation). --- irc/mysql/history.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/irc/mysql/history.go b/irc/mysql/history.go index 8d78291e..39a13697 100644 --- a/irc/mysql/history.go +++ b/irc/mysql/history.go @@ -1043,14 +1043,22 @@ func (s *mySQLHistorySequence) Between(start, end history.Selector, limit int) ( if start.Msgid != "" { startTime, _, _, err = s.mysql.lookupMsgid(ctx, start.Msgid, false) if err != nil { - return nil, err + if err == sql.ErrNoRows { + return nil, nil + } else { + return nil, err + } } } endTime := end.Time if end.Msgid != "" { endTime, _, _, err = s.mysql.lookupMsgid(ctx, end.Msgid, false) if err != nil { - return nil, err + if err == sql.ErrNoRows { + return nil, nil + } else { + return nil, err + } } }