chore: increase mailserver request timeout (#2497)

This commit is contained in:
Richard Ramos 2022-01-26 11:20:27 -04:00 committed by GitHub
parent ede86b68ce
commit 6dcc059031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -20,7 +20,7 @@ import (
// tolerance is how many seconds of potentially out-of-order messages we want to fetch
var tolerance uint32 = 60
var mailserverRequestTimeout = 45 * time.Second
var mailserverRequestTimeout = 60 * time.Second
var oneMonthInSeconds uint32 = 31 * 24 * 60 * 60
var ErrNoFiltersForChat = errors.New("no filter registered for given chat")
@ -425,6 +425,7 @@ func (m *Messenger) processMailserverBatch(batch MailserverBatch) error {
for len(cursor) != 0 || storeCursor != nil {
logger.Info("retrieved cursor", zap.String("cursor", types.EncodeHex(cursor)))
err = func() error {
ctx, cancel := context.WithTimeout(context.Background(), mailserverRequestTimeout)
defer cancel()
@ -432,6 +433,11 @@ func (m *Messenger) processMailserverBatch(batch MailserverBatch) error {
if err != nil {
return err
}
return nil
}()
if err != nil {
return err
}
}
logger.Info("waiting until message processed")
m.waitUntilP2PMessagesProcessed()