1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 11:15:51 +00:00
FairEmail/patches/RoomTrackingLiveData.patch
2021-12-21 10:31:49 +01:00

33 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) {