Skip to content

Commit

Permalink
Allow to configure EWS folder fetch page size.
Browse files Browse the repository at this point in the history
I have a mail box with more than 100 000 and it just takes too long on
connection to fetch all the message index. I wish to try using values
like 10000 (my company have a good connection, so we increase
performance by reducing the need to open new connections and transport
more data in each reply).
  • Loading branch information
Romain-Geissler-1A committed Dec 15, 2019
1 parent f6c53a6 commit 0772feb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/java/davmail/exchange/ews/EwsExchangeSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ protected List<EWSMethod.Item> searchItems(String folderPath, Set<String> attrib
FindItemMethod findItemMethod;
do {
// search items in folder, do not retrieve all properties
findItemMethod = new FindItemMethod(folderQueryTraversal, BaseShape.ID_ONLY, folderId, resultCount, PAGE_SIZE);
findItemMethod = new FindItemMethod(folderQueryTraversal, BaseShape.ID_ONLY, folderId, resultCount, getPageSize());
for (String attribute : attributes) {
findItemMethod.addAdditionalProperty(Field.get(attribute));
}
Expand Down Expand Up @@ -742,7 +742,7 @@ protected List<EWSMethod.Item> searchItems(String folderPath, Set<String> attrib
}
resultCount = results.size();
if (resultCount > 0 && LOGGER.isDebugEnabled()) {
LOGGER.debug("Folder " + folderPath + " - Search items current count: " + resultCount + " fetchCount: " + PAGE_SIZE
LOGGER.debug("Folder " + folderPath + " - Search items current count: " + resultCount + " fetchCount: " + getPageSize()
+ " highest uid: " + results.get(resultCount - 1).get(Field.get("imapUid").getResponseName())
+ " lowest uid: " + results.get(0).get(Field.get("imapUid").getResponseName()));
}
Expand Down Expand Up @@ -3246,5 +3246,9 @@ protected String convertPriorityToExchange(String vTodoPriorityValue) {
}
return value;
}

private static int getPageSize() {
return Settings.getIntProperty("davmail.folderFetchPageSize", PAGE_SIZE);
}
}

0 comments on commit 0772feb

Please sign in to comment.