mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-21 21:57:19 +00:00
Use dedicated task executors
This commit is contained in:
parent
49f78b59ca
commit
24e4a4e40b
1 changed files with 8 additions and 2 deletions
|
@ -71,6 +71,12 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
|||
private static Context themedContext = null;
|
||||
private static final List<SimpleTask> tasks = new ArrayList<>();
|
||||
|
||||
private static final ExecutorService serialExecutor =
|
||||
Helper.getBackgroundExecutor(0, 1, 3, "tasks/serial");
|
||||
|
||||
private static final ExecutorService globalExecutor =
|
||||
Helper.getBackgroundExecutor(0, 0, 3, "tasks/global");
|
||||
|
||||
private static final int REPORT_AFTER = 15 * 60 * 1000; // milliseconds
|
||||
|
||||
static final String ACTION_TASK_COUNT = BuildConfig.APPLICATION_ID + ".ACTION_TASK_COUNT";
|
||||
|
@ -108,7 +114,7 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
|||
}
|
||||
|
||||
public SimpleTask<T> serial() {
|
||||
return setExecutor(Helper.getSerialTaskExecutor());
|
||||
return setExecutor(serialExecutor);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -127,7 +133,7 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
|||
if (localExecutor != null)
|
||||
return localExecutor;
|
||||
|
||||
return Helper.getParallelExecutor();
|
||||
return globalExecutor;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
Loading…
Reference in a new issue