fix: iterate through message with batch topics (#2444)

When iterating, reuse the list of topics rather
than all topics
This commit is contained in:
Anthony Laibe 2021-11-26 12:59:53 +01:00 committed by GitHub
parent a65c873b8f
commit 25e1c64ef5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -1 +1 @@
0.91.8
0.91.9

View File

@ -419,12 +419,13 @@ func (m *Messenger) processMailserverBatch(batch MailserverBatch) error {
if err != nil {
return err
}
for len(cursor) != 0 || storeCursor != nil {
logger.Info("retrieved cursor", zap.String("cursor", types.EncodeHex(cursor)))
ctx, cancel := context.WithTimeout(context.Background(), mailserverRequestTimeout)
defer cancel()
cursor, storeCursor, err = m.transport.SendMessagesRequest(ctx, m.mailserver, batch.From, batch.To, cursor, storeCursor, true)
cursor, storeCursor, err = m.transport.SendMessagesRequestForTopics(ctx, m.mailserver, batch.From, batch.To, cursor, storeCursor, batch.Topics, true)
if err != nil {
return err
}