mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 02:07:12 +00:00
31 lines
1.6 KiB
Diff
31 lines
1.6 KiB
Diff
diff --git a/app/src/main/java/androidx/lifecycle/ComputableLiveData.kt b/app/src/main/java/androidx/lifecycle/ComputableLiveData.kt
|
|
index 94aa8d7f72..ebdb5de278 100644
|
|
--- a/app/src/main/java/androidx/lifecycle/ComputableLiveData.kt
|
|
+++ b/app/src/main/java/androidx/lifecycle/ComputableLiveData.kt
|
|
@@ -69,13 +69,26 @@ constructor(
|
|
// as long as it is invalid, keep computing.
|
|
try {
|
|
var value: T? = null
|
|
+ var once = true;
|
|
+ var last = android.os.SystemClock.elapsedRealtime()
|
|
while (invalid.compareAndSet(true, false)) {
|
|
+ var now = android.os.SystemClock.elapsedRealtime()
|
|
+ if (value != null && (once || last + 2500 < now)) {
|
|
+ eu.faircode.email.Log.i(liveData.toString() + " post once=" + once + " age=" + (now - last) + " ms")
|
|
+ once = false;
|
|
+ last = now;
|
|
+ liveData.postValue(value);
|
|
+ }
|
|
computed = true
|
|
value = compute()
|
|
}
|
|
if (computed) {
|
|
liveData.postValue(value)
|
|
}
|
|
+ } catch (ex: Throwable) {
|
|
+ // java.lang.IllegalStateException: Couldn't read row xxx column yyy
|
|
+ eu.faircode.email.Log.e(ex);
|
|
+ invalid.set(true);
|
|
} finally {
|
|
// release compute lock
|
|
computing.set(false)
|