From 4aa51f98821e506091faba4b1237e5a3fd48fd0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?rich=CE=9Brd?= Date: Fri, 16 Aug 2024 14:26:10 -0400 Subject: [PATCH] fix_: wait for mailserver available signal to change missing messages criteria (#5686) --- protocol/messenger_mailserver.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/protocol/messenger_mailserver.go b/protocol/messenger_mailserver.go index 238dab637..c5d0787ae 100644 --- a/protocol/messenger_mailserver.go +++ b/protocol/messenger_mailserver.go @@ -396,11 +396,17 @@ func (m *Messenger) checkForMissingMessagesLoop() { t := time.NewTicker(missingMessageCheckPeriod) defer t.Stop() + mailserverAvailableSignal := m.SubscribeMailserverAvailable() + for { select { case <-m.quit: return + // Wait for mailserver available, also triggered on mailserver change + case <-mailserverAvailableSignal: + mailserverAvailableSignal = m.SubscribeMailserverAvailable() + case <-t.C: }