1
0
Fork 0
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:
M66B 2023-01-05 11:50:23 +01:00
parent 49f78b59ca
commit 24e4a4e40b

View file

@ -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