mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Limit number of fetch operations
This commit is contained in:
parent
bfbb431cff
commit
7e4e03f282
1 changed files with 8 additions and 0 deletions
|
@ -101,6 +101,8 @@ public class EntityOperation {
|
|||
static final String RULE = "rule";
|
||||
static final String PURGE = "purge";
|
||||
|
||||
private static final int MAX_FETCH = 100; // operations
|
||||
|
||||
static void queue(Context context, EntityMessage message, String name, Object... values) {
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
|
@ -315,6 +317,12 @@ public class EntityOperation {
|
|||
}
|
||||
|
||||
return;
|
||||
} else if (FETCH.equals(name)) {
|
||||
int count = db.operation().getOperationCount(message.folder, name);
|
||||
if (count >= MAX_FETCH) {
|
||||
sync(context, message.folder, false);
|
||||
return;
|
||||
}
|
||||
|
||||
} else if (DELETE.equals(name)) {
|
||||
db.message().setMessageUiHide(message.id, true);
|
||||
|
|
Loading…
Reference in a new issue