mirror of https://github.com/M66B/FairEmail.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.9 KiB
39 lines
1.9 KiB
5 years ago
|
--- ./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
|
||
5 years ago
|
T value = null;
|
||
5 years ago
|
while (mInvalid.compareAndSet(true, false)) {
|
||
|
computed = true;
|
||
|
- try {
|
||
|
- value = mComputeFunction.call();
|
||
|
- } catch (Exception e) {
|
||
6 years ago
|
- throw new RuntimeException("Exception while computing database"
|
||
|
- + " live data.", e);
|
||
5 years ago
|
+ int retry = 0;
|
||
|
+ boolean done = false;
|
||
|
+ while (!done) {
|
||
6 years ago
|
+ try {
|
||
5 years ago
|
+ value = mComputeFunction.call();
|
||
|
+ done = true;
|
||
|
+ } catch (Exception e) {
|
||
|
+ 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) {
|
||
|
+ }
|
||
6 years ago
|
+ }
|
||
6 years ago
|
}
|
||
|
}
|
||
|
if (computed) {
|
||
5 years ago
|
@@ -125,6 +136,7 @@ class RoomTrackingLiveData<T> extends Li
|
||
6 years ago
|
}
|
||
|
}
|
||
|
};
|
||
|
+
|
||
|
@SuppressLint("RestrictedApi")
|
||
|
RoomTrackingLiveData(
|
||
|
RoomDatabase database,
|