This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit da13fb2739f8bd8bca7a12f624783e1983592d64 Author: Rémi Kowalski <[email protected]> AuthorDate: Tue Sep 10 10:55:33 2019 +0200 JAMES-2885 avoid concurrent nexModSeq during flags update --- .../james/mailbox/cassandra/mail/CassandraMessageIdMapper.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java index 33db97c..a6637b8 100644 --- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java +++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java @@ -210,17 +210,16 @@ public class CassandraMessageIdMapper implements MessageIdMapper { return Flux.fromIterable(mailboxIds) .distinct() .map(mailboxId -> (CassandraId) mailboxId) - .filter(mailboxId -> haveMetaData(messageId, mailboxId)) - .flatMap(mailboxId -> flagsUpdateWithRetry(newState, updateMode, mailboxId, messageId)) + .filterWhen(mailboxId -> haveMetaData(messageId, mailboxId)) + .concatMap(mailboxId -> flagsUpdateWithRetry(newState, updateMode, mailboxId, messageId)) .flatMap(this::updateCounts) .collect(Guavate.toImmutableMap(Pair::getLeft, Pair::getRight)) .block(); } - private boolean haveMetaData(MessageId messageId, CassandraId mailboxId) { + private Mono<Boolean> haveMetaData(MessageId messageId, CassandraId mailboxId) { return imapUidDAO.retrieve((CassandraMessageId) messageId, Optional.of(mailboxId)) - .hasElements() - .block(); + .hasElements(); } private Mono<Pair<MailboxId, UpdatedFlags>> flagsUpdateWithRetry(Flags newState, MessageManager.FlagsUpdateMode updateMode, MailboxId mailboxId, MessageId messageId) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
