1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-23 16:25:30 +00:00
FairEmail/patches/room.patch

36 lines
1.8 KiB
Diff
Raw Normal View History

2019-07-28 13:49:06 +00:00
--- /home/marcel/support/room/runtime/src/main/java/androidx/room/RoomTrackingLiveData.java 2019-07-27 12:47:44.950985792 +0200
2019-08-01 07:37:09 +00:00
+++ app/src/main/java/androidx/room/RoomTrackingLiveData.java 2019-08-01 09:33:53.297685740 +0200
@@ -84,13 +84,20 @@ class RoomTrackingLiveData<T> extends Li
// as long as it is invalid, keep computing.
try {
T value = null;
- while (mInvalid.compareAndSet(true, false)) {
- computed = true;
+ int retry = 0;
+ while (mInvalid.compareAndSet(true, false) && !computed) {
try {
value = mComputeFunction.call();
2019-08-01 07:37:09 +00:00
+ computed = true;
} catch (Exception e) {
- throw new RuntimeException("Exception while computing database"
- + " live data.", e);
2019-08-01 07:37:09 +00:00
+ if (++retry > 3)
+ throw new RuntimeException(
+ "Exception while computing database live data.", e);
+ eu.faircode.email.Log.w(e);
2019-07-28 16:13:13 +00:00
+ try {
+ Thread.sleep(3000L);
2019-07-28 16:13:13 +00:00
+ } catch (InterruptedException ignored) {
+ }
}
}
if (computed) {
2019-08-01 07:37:09 +00:00
@@ -125,6 +132,7 @@ class RoomTrackingLiveData<T> extends Li
2019-07-28 13:49:06 +00:00
}
}
};
+
@SuppressLint("RestrictedApi")
RoomTrackingLiveData(
RoomDatabase database,