2019-08-16 07:58:12 +00:00
|
|
|
diff --git a/home/marcel/support/lifecycle/lifecycle-livedata/src/main/java/androidx/lifecycle/ComputableLiveData.java b/app/src/main/java/androidx/lifecycle/ComputableLiveData.java
|
|
|
|
index 837a35dbf..cc375b15b 100644
|
|
|
|
--- a/home/marcel/support/lifecycle/lifecycle-livedata/src/main/java/androidx/lifecycle/ComputableLiveData.java
|
|
|
|
+++ b/app/src/main/java/androidx/lifecycle/ComputableLiveData.java
|
|
|
|
@@ -96,7 +96,16 @@ public abstract class ComputableLiveData<T> {
|
2019-07-06 08:51:16 +00:00
|
|
|
// as long as it is invalid, keep computing.
|
|
|
|
try {
|
|
|
|
T value = null;
|
2019-08-16 07:58:12 +00:00
|
|
|
+ boolean once = true;
|
|
|
|
+ long last = android.os.SystemClock.elapsedRealtime();
|
2019-07-06 08:51:16 +00:00
|
|
|
while (mInvalid.compareAndSet(true, false)) {
|
|
|
|
+ long now = android.os.SystemClock.elapsedRealtime();
|
2019-08-14 08:33:34 +00:00
|
|
|
+ if (value != null && (once || last + 2500 < now)) {
|
|
|
|
+ eu.faircode.email.Log.i(mLiveData + " post once=" + once + " age=" + (now - last) + " ms");
|
|
|
|
+ once = false;
|
2019-07-06 08:51:16 +00:00
|
|
|
+ last = now;
|
|
|
|
+ mLiveData.postValue(value);
|
|
|
|
+ }
|
|
|
|
computed = true;
|
|
|
|
value = compute();
|
|
|
|
}
|