mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-15 08:29:31 +01:00
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).
This commit is contained in:
parent
4ba35afa85
commit
ad8c97c9bb
@ -1043,16 +1043,24 @@ func (s *mySQLHistorySequence) Between(start, end history.Selector, limit int) (
|
|||||||
if start.Msgid != "" {
|
if start.Msgid != "" {
|
||||||
startTime, _, _, err = s.mysql.lookupMsgid(ctx, start.Msgid, false)
|
startTime, _, _, err = s.mysql.lookupMsgid(ctx, start.Msgid, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if err == sql.ErrNoRows {
|
||||||
|
return nil, nil
|
||||||
|
} else {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
endTime := end.Time
|
endTime := end.Time
|
||||||
if end.Msgid != "" {
|
if end.Msgid != "" {
|
||||||
endTime, _, _, err = s.mysql.lookupMsgid(ctx, end.Msgid, false)
|
endTime, _, _, err = s.mysql.lookupMsgid(ctx, end.Msgid, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if err == sql.ErrNoRows {
|
||||||
|
return nil, nil
|
||||||
|
} else {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
results, err = s.mysql.betweenTimestamps(ctx, s.target, s.correspondent, startTime, endTime, s.cutoff, limit)
|
results, err = s.mysql.betweenTimestamps(ctx, s.target, s.correspondent, startTime, endTime, s.cutoff, limit)
|
||||||
return results, err
|
return results, err
|
||||||
|
Loading…
Reference in New Issue
Block a user