You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/03/16 01:18:40 UTC
[james-project] 10/11: [PERF] StoreMessageManager::resetRecents send events only if needed
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 <bt...@linagora.com>
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: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org