2020-06-15 14:03:49 +00:00
|
|
|
--- ./support/room/runtime/src/main/java/androidx/room/RoomTrackingLiveData.java 2020-03-23 17:03:46.216122318 +0100
|
|
|
|
+++ ./email/app/src/main/java/androidx/room/RoomTrackingLiveData.java 2020-05-25 14:21:49.137386867 +0200
|
|
|
|
@@ -86,11 +86,22 @@ class RoomTrackingLiveData<T> extends Li
|
2019-08-01 07:37:09 +00:00
|
|
|
T value = null;
|
2020-05-11 18:07:26 +00:00
|
|
|
while (mInvalid.compareAndSet(true, false)) {
|
|
|
|
computed = true;
|
|
|
|
- try {
|
|
|
|
- value = mComputeFunction.call();
|
|
|
|
- } catch (Exception e) {
|
2019-07-27 11:53:30 +00:00
|
|
|
- throw new RuntimeException("Exception while computing database"
|
|
|
|
- + " live data.", e);
|
2020-05-11 18:07:26 +00:00
|
|
|
+ int retry = 0;
|
|
|
|
+ boolean done = false;
|
|
|
|
+ while (!done) {
|
2019-07-28 16:13:13 +00:00
|
|
|
+ try {
|
2020-05-11 18:07:26 +00:00
|
|
|
+ value = mComputeFunction.call();
|
|
|
|
+ done = true;
|
2020-11-05 11:56:12 +00:00
|
|
|
+ } catch (Throwable e) {
|
2020-05-11 18:07:26 +00:00
|
|
|
+ if (++retry > 10)
|
|
|
|
+ throw new RuntimeException(
|
|
|
|
+ "Exception while computing database live data.", e);
|
|
|
|
+ eu.faircode.email.Log.w(e);
|
|
|
|
+ try {
|
|
|
|
+ Thread.sleep(3000L);
|
|
|
|
+ } catch (InterruptedException ignored) {
|
|
|
|
+ }
|
2019-07-28 16:13:13 +00:00
|
|
|
+ }
|
2019-07-27 11:53:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (computed) {
|
2020-06-15 14:03:49 +00:00
|
|
|
@@ -125,6 +136,7 @@ class RoomTrackingLiveData<T> extends Li
|
2019-07-28 13:49:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
+
|
|
|
|
@SuppressLint("RestrictedApi")
|
|
|
|
RoomTrackingLiveData(
|
|
|
|
RoomDatabase database,
|