From ed9edb3620083b3198ec27b78793fdc417955844 Mon Sep 17 00:00:00 2001 From: Jakub Date: Mon, 29 Nov 2021 12:31:09 +0100 Subject: [PATCH] GODT-1431 Do not cache message during new message event when CoD is off. --- internal/store/user_message.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/store/user_message.go b/internal/store/user_message.go index 5bf001e8..1bab2620 100644 --- a/internal/store/user_message.go +++ b/internal/store/user_message.go @@ -27,6 +27,7 @@ import ( "strings" "github.com/ProtonMail/gopenpgp/v2/crypto" + "github.com/ProtonMail/proton-bridge/internal/store/cache" "github.com/ProtonMail/proton-bridge/pkg/pmapi" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -303,8 +304,10 @@ func (store *Store) createOrUpdateMessagesEvent(msgs []*pmapi.Message) error { / } // Notify the cacher that it should start caching messages. - for _, msg := range msgs { - store.msgCachePool.newJob(msg.ID) + if cache.IsOnDiskCache(store.cache) { + for _, msg := range msgs { + store.msgCachePool.newJob(msg.ID) + } } return nil