Retry on compute exception

This commit is contained in:
M66B 2019-07-28 18:13:13 +02:00
parent 3e88be112d
commit 410170d6d6
2 changed files with 11 additions and 7 deletions

View File

@ -93,8 +93,10 @@ class RoomTrackingLiveData<T> extends LiveData<T> {
//throw new RuntimeException("Exception while computing database"
// + " live data.", e);
computed = false;
mInvalid.set(false);
break;
try {
Thread.sleep(5000L);
} catch (InterruptedException ignored) {
}
}
}
if (computed) {

View File

@ -1,6 +1,6 @@
--- /home/marcel/support/room/runtime/src/main/java/androidx/room/RoomTrackingLiveData.java 2019-07-27 12:47:44.950985792 +0200
+++ app/src/main/java/androidx/room/RoomTrackingLiveData.java 2019-07-28 15:50:45.670936158 +0200
@@ -89,8 +89,12 @@ class RoomTrackingLiveData<T> extends Li
+++ app/src/main/java/androidx/room/RoomTrackingLiveData.java 2019-07-28 18:06:23.373936158 +0200
@@ -89,8 +89,14 @@ class RoomTrackingLiveData<T> extends Li
try {
value = mComputeFunction.call();
} catch (Exception e) {
@ -10,12 +10,14 @@
+ //throw new RuntimeException("Exception while computing database"
+ // + " live data.", e);
+ computed = false;
+ mInvalid.set(false);
+ break;
+ try {
+ Thread.sleep(5000L);
+ } catch (InterruptedException ignored) {
+ }
}
}
if (computed) {
@@ -125,6 +129,7 @@ class RoomTrackingLiveData<T> extends Li
@@ -125,6 +131,7 @@ class RoomTrackingLiveData<T> extends Li
}
}
};