mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-21 15:08:52 -05:00
IMAP: implement separate thread folder load on STATUS request to avoid client timeouts
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2285 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
89d0ed029f
commit
dd1cfea379
@ -569,7 +569,18 @@ public class ImapConnection extends AbstractConnection {
|
||||
String folderName = BASE64MailboxDecoder.decode(encodedFolderName);
|
||||
ExchangeSession.Folder folder = session.getFolder(folderName);
|
||||
// must retrieve messages
|
||||
folder.loadMessages();
|
||||
|
||||
// use folder.loadMessages() for small folders only
|
||||
LOGGER.debug("*");
|
||||
os.write('*');
|
||||
if (folder.count() <= 500) {
|
||||
// simple folder load
|
||||
folder.loadMessages();
|
||||
} else {
|
||||
// load folder in a separate thread
|
||||
FolderLoadThread.loadFolder(folder, os);
|
||||
}
|
||||
|
||||
String parameters = tokens.nextToken();
|
||||
StringBuilder answer = new StringBuilder();
|
||||
StringTokenizer parametersTokens = new StringTokenizer(parameters);
|
||||
@ -600,7 +611,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
answer.append("UNSEEN ").append(folder.unreadCount).append(' ');
|
||||
}
|
||||
}
|
||||
sendClient("* STATUS \"" + encodedFolderName + "\" (" + answer.toString().trim() + ')');
|
||||
sendClient(" STATUS \"" + encodedFolderName + "\" (" + answer.toString().trim() + ')');
|
||||
sendClient(commandId + " OK " + command + " completed");
|
||||
} catch (HttpException e) {
|
||||
sendClient(commandId + " NO folder not found");
|
||||
|
Loading…
Reference in New Issue
Block a user