Move database calls from Schedulers.io to Schedulers.computation (#8374)

### Description

Move database calls from `Schedulers.io` to `Schedulers.computation`.
The io scheduler is unbounded, starting an arbitrary number of threads.
This might be a reason for the lock inflation failing. In contrast, the
`compute` scheduler is limited by the number of available threads.

Contributes to #8338

### Checklist
<!-- 
To help us keep the issue tracker clean and work as efficient as
possible,
  please make sure that you have done all of the following.
You can tick the boxes below by placing an x inside the brackets like
this: [x]
-->
- [x] I have read the contribution guidelines:
https://github.com/AntennaPod/AntennaPod/blob/develop/CONTRIBUTING.md#submit-a-pull-request
- [x] I have performed a self-review of my code, going through my
changes line by line and carefully considering why this line change is
necessary
- [x] I have run the automated code checks using `./gradlew checkstyle
lint spotbugsPlayDebug spotbugsDebug`
- [x] My code follows the style guidelines of the AntennaPod project:
https://antennapod.org/contribute/develop/app/code-style
- [x] I have mentioned the corresponding issue and the relevant keyword
(e.g., "Closes: #xy") in the description (see
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
- [x] If it is a core feature, I have added automated tests
This commit is contained in:
Hans-Peter Lehmann
2026-03-30 22:51:36 +02:00
committed by GitHub
parent 98712dca38
commit 97416e0458
60 changed files with 78 additions and 78 deletions

View File

@ -32,7 +32,7 @@ public class FyydPodcastSearcher implements PodcastSearcher {
subscriber.onSuccess(searchResults);
})
.subscribeOn(Schedulers.io())
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread());
}

View File

@ -78,8 +78,8 @@ public class DownloadServiceInterfaceImpl extends DownloadServiceInterface {
String tag = WORK_TAG_EPISODE_URL + media.getDownloadUrl();
Future<List<WorkInfo>> future = WorkManager.getInstance(context).getWorkInfosByTag(tag);
Observable.fromFuture(future)
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribeOn(Schedulers.computation())
.observeOn(Schedulers.computation())
.subscribe(
workInfos -> {
for (WorkInfo info : workInfos) {

View File

@ -28,7 +28,7 @@ public class LockingAsyncExecutor {
} finally {
lock.unlock();
}
}).subscribeOn(Schedulers.io())
}).subscribeOn(Schedulers.computation())
.subscribe();
}
}