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 134257c5fc1fd7c9d8c40aec77274dc6bd5fc1c5 Author: Benoit Tellier <[email protected]> AuthorDate: Fri Mar 11 09:25:22 2022 +0700 [PERF] StoreMessageManager::resetRecents send events only if needed If there is no recents we don't want to: - generate an eventId - Instanciate the event - Pay a scheduling price (block) Also we don't need to switch this call to another scheduler, current thread is fine. --- .../james/mailbox/store/StoreMessageManager.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java index a3186c3..692f5e2 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java @@ -752,15 +752,16 @@ public class StoreMessageManager implements MessageManager { List<UpdatedFlags> updatedFlags = messageMapper.resetRecent(getMailboxEntity()); - eventBus.dispatch(EventFactory.flagsUpdated() - .randomEventId() - .mailboxSession(mailboxSession) - .mailbox(getMailboxEntity()) - .updatedFlags(updatedFlags) - .build(), - new MailboxIdRegistrationKey(mailbox.getMailboxId())) - .subscribeOn(Schedulers.elastic()) - .block(); + if (!updatedFlags.isEmpty()) { + eventBus.dispatch(EventFactory.flagsUpdated() + .randomEventId() + .mailboxSession(mailboxSession) + .mailbox(getMailboxEntity()) + .updatedFlags(updatedFlags) + .build(), + new MailboxIdRegistrationKey(mailbox.getMailboxId())) + .block(); + } return updatedFlags.stream() .map(UpdatedFlags::getUid) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
