1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-30 11:45:36 +00:00
FairEmail/patches/RoomTrackingLiveData.patch

34 lines
1.8 KiB
Diff
Raw Normal View History

2021-12-21 09:03:16 +00:00
diff --git a/app/src/main/java/androidx/room/RoomTrackingLiveData.java b/app/src/main/java/androidx/room/RoomTrackingLiveData.java
index 8df1014a4..d02ab8fea 100644
--- a/app/src/main/java/androidx/room/RoomTrackingLiveData.java
+++ b/app/src/main/java/androidx/room/RoomTrackingLiveData.java
@@ -85,12 +85,22 @@ class RoomTrackingLiveData<T> extends LiveData<T> {
try {
2019-08-01 07:37:09 +00:00
T value = null;
2020-05-11 18:07:26 +00:00
while (mInvalid.compareAndSet(true, false)) {
2021-12-21 09:03:16 +00:00
- computed = true;
2020-05-11 18:07:26 +00:00
- try {
- value = mComputeFunction.call();
- } catch (Exception e) {
- throw new RuntimeException("Exception while computing database"
- + " live data.", e);
2020-05-11 18:07:26 +00:00
+ int retry = 0;
2021-12-21 09:03:16 +00:00
+ while (!computed) {
2019-07-28 16:13:13 +00:00
+ try {
2020-05-11 18:07:26 +00:00
+ value = mComputeFunction.call();
2021-12-21 09:03:16 +00:00
+ computed = true;
2020-11-05 11:56:12 +00:00
+ } catch (Throwable e) {
2021-12-21 09:03:16 +00:00
+ if (++retry > 5) {
+ eu.faircode.email.Log.e(e);
+ break;
+ }
2020-05-11 18:07:26 +00:00
+ eu.faircode.email.Log.w(e);
+ try {
2021-12-21 09:03:16 +00:00
+ Thread.sleep(2000L);
2020-05-11 18:07:26 +00:00
+ } catch (InterruptedException ignored) {
+ }
2019-07-28 16:13:13 +00:00
+ }
}
}
if (computed) {