chibenwa commented on code in PR #2750: URL: https://github.com/apache/james-project/pull/2750#discussion_r2167534412
########## 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: (Fixed) -- 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: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org