mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Added fetch yield
This commit is contained in:
parent
ab224f1103
commit
3cbba021e5
1 changed files with 7 additions and 0 deletions
|
@ -119,6 +119,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
private static final int ACCOUNT_ERROR_AFTER_POLL = 4; // times
|
||||
private static final int BACKOFF_ERROR_AFTER = 16; // seconds
|
||||
private static final int FAST_FAIL_THRESHOLD = 75; // percent
|
||||
private static final int FETCH_YIELD_DURATION = 50; // milliseconds
|
||||
|
||||
private static final String ACTION_NEW_MESSAGE_COUNT = BuildConfig.APPLICATION_ID + ".NEW_MESSAGE_COUNT";
|
||||
|
||||
|
@ -1175,6 +1176,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
Thread.sleep(FETCH_YIELD_DURATION);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(folder.name, ex);
|
||||
EntityLog.log(
|
||||
|
@ -1204,6 +1207,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
Thread.sleep(FETCH_YIELD_DURATION);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(folder.name, ex);
|
||||
EntityLog.log(
|
||||
|
@ -1228,6 +1233,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
|
||||
long uid = ifolder.getUID(e.getMessage());
|
||||
EntityOperation.queue(ServiceSynchronize.this, folder, EntityOperation.FETCH, uid);
|
||||
|
||||
Thread.sleep(FETCH_YIELD_DURATION);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(folder.name, ex);
|
||||
EntityLog.log(
|
||||
|
|
Loading…
Reference in a new issue