mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-23 00:06:27 +00:00
21 lines
1.4 KiB
Diff
21 lines
1.4 KiB
Diff
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> {
|
|
// as long as it is invalid, keep computing.
|
|
try {
|
|
T value = null;
|
|
+ boolean once = true;
|
|
+ long last = android.os.SystemClock.elapsedRealtime();
|
|
while (mInvalid.compareAndSet(true, false)) {
|
|
+ long now = android.os.SystemClock.elapsedRealtime();
|
|
+ if (value != null && (once || last + 2500 < now)) {
|
|
+ eu.faircode.email.Log.i(mLiveData + " post once=" + once + " age=" + (now - last) + " ms");
|
|
+ once = false;
|
|
+ last = now;
|
|
+ mLiveData.postValue(value);
|
|
+ }
|
|
computed = true;
|
|
value = compute();
|
|
}
|