Fixed mail event thread exhaustion

This commit is contained in:
M66B 2022-12-28 12:20:58 +01:00
parent 773726594e
commit d1e802299d
2 changed files with 3 additions and 5 deletions

View File

@ -128,9 +128,6 @@ public class EmailService implements AutoCloseable {
final static int DEFAULT_CONNECT_TIMEOUT = 20; // seconds
final static boolean SEPARATE_STORE_CONNECTION = false;
private static final ExecutorService executor =
Helper.getBackgroundExecutor(0, 4, 3, "mail");
private final static int SEARCH_TIMEOUT = 90 * 1000; // milliseconds
private final static int FETCH_SIZE = 1024 * 1024; // bytes, default 16K
private final static int POOL_SIZE = 1; // connections
@ -207,8 +204,8 @@ public class EmailService implements AutoCloseable {
" apop=" + auth_apop +
" use_top=" + use_top);
properties.put("mail.event.scope", "folder");
properties.put("mail.event.executor", executor);
//properties.put("mail.event.scope", "folder");
//properties.put("mail.event.executor", executor);
if (!auth_plain)
properties.put("mail." + protocol + ".auth.plain.disable", "true");

View File

@ -89,6 +89,7 @@ class EventQueue implements Runnable {
executor.execute(this);
} else {
Thread qThread = new Thread(this, "Jakarta-Mail-EventQueue");
qThread.setPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
qThread.setDaemon(true); // not a user thread
qThread.start();
}