mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-18 21:28:54 +00:00
Skip polling of on demand accounts
This commit is contained in:
parent
8b76023b1b
commit
3ed182530d
2 changed files with 15 additions and 9 deletions
|
@ -37,6 +37,13 @@ public interface DaoAccount {
|
|||
" ORDER BY `order`, `primary` DESC, name COLLATE NOCASE")
|
||||
List<EntityAccount> getSynchronizingAccounts();
|
||||
|
||||
@Query("SELECT * FROM account" +
|
||||
" WHERE (:id IS NULL OR id = :id)" +
|
||||
" AND synchronize" +
|
||||
" AND NOT ondemand" +
|
||||
" ORDER BY `order`, `primary` DESC, name COLLATE NOCASE")
|
||||
List<EntityAccount> getPollAccounts(Long id);
|
||||
|
||||
@Query("SELECT * FROM account WHERE synchronize")
|
||||
LiveData<List<EntityAccount>> liveSynchronizingAccounts();
|
||||
|
||||
|
|
|
@ -445,15 +445,14 @@ public class ServiceUI extends IntentService {
|
|||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
List<EntityAccount> accounts = db.account().getSynchronizingAccounts();
|
||||
for (EntityAccount account : accounts)
|
||||
if (aid < 0 || account.id.equals(aid)) {
|
||||
List<EntityFolder> folders = db.folder().getSynchronizingFolders(account.id);
|
||||
if (folders.size() > 0)
|
||||
Collections.sort(folders, folders.get(0).getComparator(this));
|
||||
for (EntityFolder folder : folders)
|
||||
EntityOperation.sync(this, folder.id, false);
|
||||
}
|
||||
List<EntityAccount> accounts = db.account().getPollAccounts(aid < 0 ? null : aid);
|
||||
for (EntityAccount account : accounts) {
|
||||
List<EntityFolder> folders = db.folder().getSynchronizingFolders(account.id);
|
||||
if (folders.size() > 0)
|
||||
Collections.sort(folders, folders.get(0).getComparator(this));
|
||||
for (EntityFolder folder : folders)
|
||||
EntityOperation.sync(this, folder.id, false);
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
|
|
Loading…
Reference in a new issue