Skip to content

Commit b8785e5

Browse files
wangYX657211334artembilan
authored andcommitted
GH-3619: Fix Mail Receiver fetch redundant Messages
Fixes #3619 The `AbstractMailReceiver` fetche redundant messages, causing performance problems * Use correct, already filtered, array of message to fetch **Cherry-pick to `main` & `5.3.x`**
1 parent 55876e0 commit b8785e5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
* @author Gary Russell
6666
* @author Artem Bilan
6767
* @author Dominik Simmen
68+
* @author Yuxin Wang
6869
*/
6970
public abstract class AbstractMailReceiver extends IntegrationObjectSupport implements MailReceiver, DisposableBean {
7071

@@ -413,7 +414,7 @@ private MimeMessage[] searchAndFilterMessages() throws MessagingException {
413414
}
414415
this.logger.debug(() -> "found " + messagesToProcess.length + " new messages");
415416
if (messagesToProcess.length > 0) {
416-
fetchMessages(messages);
417+
fetchMessages(messagesToProcess);
417418
}
418419

419420
this.logger.debug(() -> "Received " + messagesToProcess.length + " messages");

0 commit comments

Comments
 (0)