msgstore: revert 9fdc7acf5b
"post messageInfo on erroneous fetch"
Commit 9fdc7acf5b
("cache: fetch flags from UI") introduced a
regression where all messages were marked as erroneous if a single one
in the fetch request had an error.
Reported-by: Jose Lombera <jose@lombera.dev>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
e5b0725824
commit
a9af5635bc
1 changed files with 1 additions and 13 deletions
|
@ -119,9 +119,8 @@ func (store *MessageStore) FetchHeaders(uids []uint32,
|
||||||
}
|
}
|
||||||
if len(toFetch) > 0 {
|
if len(toFetch) > 0 {
|
||||||
store.worker.PostAction(&types.FetchMessageHeaders{Uids: toFetch}, func(msg types.WorkerMessage) {
|
store.worker.PostAction(&types.FetchMessageHeaders{Uids: toFetch}, func(msg types.WorkerMessage) {
|
||||||
if msg, ok := msg.(*types.Error); ok {
|
if _, ok := msg.(*types.Error); ok {
|
||||||
for _, uid := range toFetch {
|
for _, uid := range toFetch {
|
||||||
store.postInvalidMessageInfo(uid, msg.Error)
|
|
||||||
delete(store.pendingHeaders, uid)
|
delete(store.pendingHeaders, uid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,17 +131,6 @@ func (store *MessageStore) FetchHeaders(uids []uint32,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (store *MessageStore) postInvalidMessageInfo(uid uint32, err error) {
|
|
||||||
logging.Errorf("Unable to fetch header %d: %w", uid, err)
|
|
||||||
info := &models.MessageInfo{
|
|
||||||
Envelope: &models.Envelope{},
|
|
||||||
Flags: []models.Flag{models.SeenFlag},
|
|
||||||
Uid: uid,
|
|
||||||
Error: err,
|
|
||||||
}
|
|
||||||
store.Update(&types.MessageInfo{Info: info})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (store *MessageStore) FetchFull(uids []uint32, cb func(*types.FullMessage)) {
|
func (store *MessageStore) FetchFull(uids []uint32, cb func(*types.FullMessage)) {
|
||||||
// TODO: this could be optimized by pre-allocating toFetch and trimming it
|
// TODO: this could be optimized by pre-allocating toFetch and trimming it
|
||||||
// at the end. In practice we expect to get most messages back in one frame.
|
// at the end. In practice we expect to get most messages back in one frame.
|
||||||
|
|
Loading…
Reference in a new issue