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.
|
|
|
diff --git a/home/marcel/tmp/RoomTrackingLiveData.java b/app/src/main/java/androidx/room/RoomTrackingLiveData.java
|
|
|
|
index 8df1014a4..875beba9b 100644
|
|
|
|
--- a/home/marcel/tmp/RoomTrackingLiveData.java
|
|
|
|
+++ b/app/src/main/java/androidx/room/RoomTrackingLiveData.java
|
|
|
|
@@ -86,11 +86,22 @@ class RoomTrackingLiveData<T> extends LiveData<T> {
|
|
|
|
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;
|
|
|
|
+ boolean done = false;
|
|
|
|
+ while (!done) {
|
|
|
|
+ try {
|
|
|
|
+ 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) {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (computed) {
|
|
|
|
@@ -125,6 +136,7 @@ class RoomTrackingLiveData<T> extends LiveData<T> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
+
|
|
|
|
@SuppressLint("RestrictedApi")
|
|
|
|
RoomTrackingLiveData(
|
|
|
|
RoomDatabase database,
|