-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
ideal-for-user-contributionAn issue that would ideal for a user to get started with contributing.An issue that would ideal for a user to get started with contributing.in: mailtype: bug
Milestone
Description
Version
org.springframework.integration:spring-integration-mail:5.5.3
Describe the bug
example:
Pop3MailReceiver mailReceiver = ...;
mailReceiver.setMaxFetchSize(10);
Object[] messages = mailReceiver.receive();
The above code execute result messages.length
is 10, it is right
but, in the org.springframework.integration.mail.AbstractMailReceiver.searchAndFilterMessages
method, fetch all messages, Cause performance problems
spring-integration-mail
source code:
private MimeMessage[] searchAndFilterMessages() throws MessagingException {
this.logger.debug(() -> "attempting to receive mail from folder [" + this.folder.getFullName() + "]");
Message[] messagesToProcess;
Message[] messages = searchForNewMessages();
if (this.maxFetchSize > 0 && messages.length > this.maxFetchSize) {
Message[] reducedMessages = new Message[this.maxFetchSize];
System.arraycopy(messages, 0, reducedMessages, 0, this.maxFetchSize);
messagesToProcess = reducedMessages;
}
else {
messagesToProcess = messages;
}
this.logger.debug(() -> "found " + messagesToProcess.length + " new messages");
if (messagesToProcess.length > 0) {
fetchMessages(messages);
}
this.logger.debug(() -> "Received " + messagesToProcess.length + " messages");
MimeMessage[] filteredMessages = filterMessagesThruSelector(messagesToProcess);
postProcessFilteredMessages(filteredMessages);
return filteredMessages;
}
commit link
fetchMessages(messages);
changed to fetchMessages(messagesToProcess);
?
Metadata
Metadata
Assignees
Labels
ideal-for-user-contributionAn issue that would ideal for a user to get started with contributing.An issue that would ideal for a user to get started with contributing.in: mailtype: bug