From 1e52dfbc9e2f395eb24441306179bd47fc0d6ca3 Mon Sep 17 00:00:00 2001
From: Stephen Paul Weber <singpolyma@singpolyma.net>
Date: Tue, 8 Oct 2024 22:39:44 -0500
Subject: [PATCH] No refreshUi thundering herd

But may delay by more than the interval this way

(cherry picked from commit ff2bdc8474e9938ceba529fac7858ed88c4ed98e)
---
 src/main/java/eu/siacs/conversations/ui/XmppActivity.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 68fb4352d..3bd1b793a 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -236,7 +236,7 @@ public abstract class XmppActivity extends ActionBarActivity {
         final long diff = SystemClock.elapsedRealtime() - mLastUiRefresh;
         if (diff > Config.REFRESH_UI_INTERVAL) {
             mRefreshUiHandler.removeCallbacks(mRefreshUiRunnable);
-            runOnUiThread(mRefreshUiRunnable);
+            mRefreshUiHandler.postDelayed(mRefreshUiRunnable, 1);
         } else {
             final long next = Config.REFRESH_UI_INTERVAL - diff;
             mRefreshUiHandler.removeCallbacks(mRefreshUiRunnable);