quantranhong1999 commented on code in PR #2750:
URL: https://github.com/apache/james-project/pull/2750#discussion_r2161577181
##########
mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraThreadIdGuessingAlgorithm.java:
##########
@@ -88,17 +86,17 @@ public Flux<MessageId> getMessageIdsInThread(ThreadId
threadId, MailboxSession s
return Flux.just(threadId.getBaseMessageId());
}
- SearchQuery searchQuery = SearchQuery.builder()
- .andCriteria(SearchQuery.threadId(threadId))
- .sorts(new SearchQuery.Sort(SearchQuery.Sort.SortClause.Arrival,
SearchQuery.Sort.Order.NATURAL))
- .build();
-
- MultimailboxesSearchQuery expression = MultimailboxesSearchQuery
- .from(searchQuery)
- .build();
-
- return Flux.from(mailboxManager.search(expression, session,
Integer.MAX_VALUE))
- .switchIfEmpty(Mono.error(() -> new
ThreadNotFoundException(threadId)));
+ return threadLookupDAO.selectAll(threadId)
+ .collectList()
+ .map(ids -> {
+ // Handle umpopulated lookup dao
+ if (ids.isEmpty()) {
+ return ImmutableList.of(threadId.getBaseMessageId());
+ }
+ return ids;
+ })
+ .flatMapMany(messageIds ->
messageIdManager.accessibleMessagesReactive(messageIds, session))
Review Comment:
> And I am not sure if threadLookupDAO.selectAll(threadId) keeps ordering
well too in the first place.
should be the case already as messageId is timeuuid
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]