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 23725df48e41ae681c4dcb3147098de36cbd86b6 Author: Benoit Tellier <btell...@linagora.com> AuthorDate: Fri Mar 27 14:11:15 2020 +0700 JAMES-2997 Store attachments sequentially with Cassandra --- .../mailbox/cassandra/mail/CassandraAttachmentMapper.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentMapper.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentMapper.java index 62ed3f0..12a0d4c 100644 --- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentMapper.java +++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentMapper.java @@ -115,20 +115,20 @@ public class CassandraAttachmentMapper implements AttachmentMapper { CurrentPositionInputStream currentPositionInputStream = new CurrentPositionInputStream(inputStream); AttachmentId attachmentId = AttachmentId.random(); return ownerDAO.addOwner(attachmentId, owner) - .flatMap(any -> Mono.from(blobStore.save(blobStore.getDefaultBucketName(), currentPositionInputStream, LOW_COST))) - .map(blobId -> new DAOAttachment(attachmentId, blobId, contentType, currentPositionInputStream.getPosition())) + .then(Mono.from(blobStore.save(blobStore.getDefaultBucketName(), currentPositionInputStream, LOW_COST))) + .map(blobId -> new DAOAttachment(attachmentId, blobId, contentType, currentPositionInputStream.getPosition())) .flatMap(attachmentDAOV2::storeAttachment) - .map(any -> Attachment.builder() + .then(Mono.defer(() -> Mono.just(Attachment.builder() .attachmentId(attachmentId) .type(contentType) .size(currentPositionInputStream.getPosition()) - .build()); + .build()))); } @Override public List<MessageAttachment> storeAttachmentsForMessage(Collection<ParsedAttachment> parsedAttachments, MessageId ownerMessageId) throws MailboxException { return Flux.fromIterable(parsedAttachments) - .flatMap(attachment -> storeAttachmentAsync(attachment, ownerMessageId)) + .concatMap(attachment -> storeAttachmentAsync(attachment, ownerMessageId)) .collectList() .block(); } --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org