From 22cc72ab87d3643ceedff163cca4e61701d508cc Mon Sep 17 00:00:00 2001 From: Tad Date: Mon, 15 May 2023 23:52:14 -0400 Subject: [PATCH] Fix the downloader With all databases enabled the ThreadPool queue is exceed (25>16). This normally isn't an issue for other users of the pool as it will get pushed onto the main thread. But Android prohibits network activity on the main thread, which the downloader runs from. Increase it 32 which should be suitable for now. Maybe consider adding a separate pool in future. Fixes https://github.com/Divested-Mobile/Hypatia/issues/34 Fixes https://gitlab.com/divested-mobile/hypatia/-/issues/31 Signed-off-by: Tad --- app/build.gradle | 2 +- app/src/main/java/us/spotco/malwarescanner/Utils.java | 2 +- fastlane/metadata/android/en-US/changelogs/102.txt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/102.txt diff --git a/app/build.gradle b/app/build.gradle index c0de978..140b832 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,7 @@ android { applicationId "us.spotco.malwarescanner" minSdkVersion 16 targetSdkVersion 32 - versionCode 101 + versionCode 102 versionName "2.32" resConfigs 'en', 'af', 'de', 'es', 'fi', 'fr', 'it', 'pl', 'pt', 'ru', 'tr', 'zh-rCN' } diff --git a/app/src/main/java/us/spotco/malwarescanner/Utils.java b/app/src/main/java/us/spotco/malwarescanner/Utils.java index 2c5f3e6..25710e2 100644 --- a/app/src/main/java/us/spotco/malwarescanner/Utils.java +++ b/app/src/main/java/us/spotco/malwarescanner/Utils.java @@ -53,7 +53,7 @@ class Utils { } public static ThreadPoolExecutor getNewThreadPoolExecutor(int threads) { - return new ThreadPoolExecutor(threads, threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(16), new ThreadPoolExecutor.CallerRunsPolicy()); + return new ThreadPoolExecutor(threads, threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(32), new ThreadPoolExecutor.CallerRunsPolicy()); } public static int getMaxThreads() { diff --git a/fastlane/metadata/android/en-US/changelogs/102.txt b/fastlane/metadata/android/en-US/changelogs/102.txt new file mode 100644 index 0000000..8287495 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/102.txt @@ -0,0 +1 @@ +* Fix the downloader when many databases are enabled