mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-23 00:06:27 +00:00
27 lines
1.4 KiB
Diff
27 lines
1.4 KiB
Diff
diff --git a/app/src/main/java/androidx/lifecycle/ComputableLiveData.java b/app/src/main/java/androidx/lifecycle/ComputableLiveData.java
|
|
index 837a35dbf..338af5c89 100644
|
|
--- a/app/src/main/java/androidx/lifecycle/ComputableLiveData.java
|
|
+++ b/app/src/main/java/androidx/lifecycle/ComputableLiveData.java
|
|
@@ -89,14 +89,22 @@ public abstract class ComputableLiveData<T> {
|
|
@Override
|
|
public void run() {
|
|
boolean computed;
|
|
+ long last;
|
|
do {
|
|
computed = false;
|
|
// compute can happen only in 1 thread but no reason to lock others.
|
|
if (mComputing.compareAndSet(false, true)) {
|
|
// as long as it is invalid, keep computing.
|
|
try {
|
|
+ last = android.os.SystemClock.elapsedRealtime();
|
|
T value = null;
|
|
while (mInvalid.compareAndSet(true, false)) {
|
|
+ long now = android.os.SystemClock.elapsedRealtime();
|
|
+ if (last + 1500 < now && value != null) {
|
|
+ eu.faircode.email.Log.i(mLiveData + " post age=" + (now - last));
|
|
+ last = now;
|
|
+ mLiveData.postValue(value);
|
|
+ }
|
|
computed = true;
|
|
value = compute();
|
|
}
|