]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: mail_cache_compress() - Make sure compression sees the latest changes...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 30 Mar 2020 15:05:42 +0000 (18:05 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Apr 2020 09:41:42 +0000 (12:41 +0300)
src/lib-index/mail-cache-compress.c

index e260f636b413a579e8c8fda8b06d98b2efba0d77..9d4f0c3334c41366b3b77eb020726b85ec4b9b3c 100644 (file)
@@ -590,11 +590,15 @@ int mail_cache_compress(struct mail_cache *cache, uint32_t compress_file_seq)
                                                   &file_seq, &file_offset) < 0)
                        return -1;
        }
+       /* make sure we see the latest changes in index */
+       ret = mail_index_refresh(cache->index);
 
        view = mail_index_view_open(cache->index);
        trans = mail_index_transaction_begin(view,
                MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL);
-       if ((ret = mail_cache_compress_full(cache, trans, compress_file_seq, &lock)) < 0)
+       if (ret < 0)
+               ;
+       else if ((ret = mail_cache_compress_full(cache, trans, compress_file_seq, &lock)) < 0)
                mail_index_transaction_rollback(&trans);
        else {
                if (mail_index_transaction_commit(&trans) < 0)