FairEmail/patches/RoomTrackingLiveData.patch

34 lines
1.8 KiB
Diff

diff --git a/app/src/main/java/androidx/room/RoomTrackingLiveData.java b/app/src/main/java/androidx/room/RoomTrackingLiveData.java
index 8df1014a4..d02ab8fea 100644
--- a/app/src/main/java/androidx/room/RoomTrackingLiveData.java
+++ b/app/src/main/java/androidx/room/RoomTrackingLiveData.java
@@ -85,12 +85,22 @@ class RoomTrackingLiveData<T> extends LiveData<T> {
try {
T value = null;
while (mInvalid.compareAndSet(true, false)) {
- computed = true;
- try {
- value = mComputeFunction.call();
- } catch (Exception e) {
- throw new RuntimeException("Exception while computing database"
- + " live data.", e);
+ int retry = 0;
+ while (!computed) {
+ try {
+ value = mComputeFunction.call();
+ computed = true;
+ } catch (Throwable e) {
+ if (++retry > 5) {
+ eu.faircode.email.Log.e(e);
+ break;
+ }
+ eu.faircode.email.Log.w(e);
+ try {
+ Thread.sleep(2000L);
+ } catch (InterruptedException ignored) {
+ }
+ }
}
}
if (computed) {