mirror of https://github.com/M66B/FairEmail.git
Auto optimize too many connections
This commit is contained in:
parent
81105e7055
commit
2f09afedac
7
FAQ.md
7
FAQ.md
|
@ -1416,13 +1416,16 @@ consider switching to a modern provider which supports push messages (IMAP IDLE)
|
||||||
If your device has an [AMOLED](https://en.wikipedia.org/wiki/AMOLED) screen,
|
If your device has an [AMOLED](https://en.wikipedia.org/wiki/AMOLED) screen,
|
||||||
you can save battery usage while viewing messages by switching to the black theme.
|
you can save battery usage while viewing messages by switching to the black theme.
|
||||||
|
|
||||||
By default auto optimize in the receive settings is enabled,
|
If auto optimize in the receive settings is enabled,
|
||||||
which will switch an account to periodically checking for new messages when the email server:
|
an account will automatically be switched to periodically checking for new messages when the email server:
|
||||||
|
|
||||||
* Says '*Still here*' within 3 minutes
|
* Says '*Still here*' within 3 minutes
|
||||||
* The email server does not support push messages
|
* The email server does not support push messages
|
||||||
* The keep-alive interval is lower than 12 minutes
|
* The keep-alive interval is lower than 12 minutes
|
||||||
|
|
||||||
|
In addition, the trash and spam folders will be automatically set to checking for new messages
|
||||||
|
after three successive [too many simultaneous connections](#user-content-faq23) errors.
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<a name="faq40"></a>
|
<a name="faq40"></a>
|
||||||
|
|
|
@ -326,6 +326,9 @@ public interface DaoFolder {
|
||||||
@Query("UPDATE folder SET tbd = 1 WHERE id = :id")
|
@Query("UPDATE folder SET tbd = 1 WHERE id = :id")
|
||||||
int setFolderTbd(long id);
|
int setFolderTbd(long id);
|
||||||
|
|
||||||
|
@Query("UPDATE folder SET poll = :poll, poll_count = 1 WHERE id = :id")
|
||||||
|
int setFolderPoll(long id, boolean poll);
|
||||||
|
|
||||||
@Query("UPDATE folder SET poll_count = :count WHERE id = :id")
|
@Query("UPDATE folder SET poll_count = :count WHERE id = :id")
|
||||||
int setFolderPollCount(long id, int count);
|
int setFolderPollCount(long id, int count);
|
||||||
|
|
||||||
|
|
|
@ -1578,6 +1578,21 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||||
" last connected: " + new Date(account.last_connected));
|
" last connected: " + new Date(account.last_connected));
|
||||||
if (errors >= FAST_ERROR_COUNT)
|
if (errors >= FAST_ERROR_COUNT)
|
||||||
state.setBackoff(FAST_ERROR_BACKOFF * 60);
|
state.setBackoff(FAST_ERROR_BACKOFF * 60);
|
||||||
|
|
||||||
|
boolean auto_optimize = prefs.getBoolean("auto_optimize", false);
|
||||||
|
if (auto_optimize) {
|
||||||
|
Throwable e = ex;
|
||||||
|
while (e != null) {
|
||||||
|
if (ConnectionHelper.isMaxConnections(e.getMessage())) {
|
||||||
|
for (String ft : new String[]{EntityFolder.TRASH, EntityFolder.JUNK}) {
|
||||||
|
EntityFolder f = db.folder().getFolderByType(account.id, ft);
|
||||||
|
if (f != null)
|
||||||
|
db.folder().setFolderPoll(f.id, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e = e.getCause();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Report account connection error
|
// Report account connection error
|
||||||
|
|
Loading…
Reference in New Issue