From 53cf740d874f376f212a5d706ca70cbf35fee259 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Fri, 19 Nov 2021 14:42:49 -0500
Subject: SL-16094: Service mainloop WorkQueue every LLAppViewer::idle() call

even if idle() exits early.
---
 indra/newview/llappviewer.cpp | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 93e5c2e341..e7f104d6fd 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4854,6 +4854,20 @@ void LLAppViewer::idle()
 	LLDirPickerThread::clearDead();
 	F32 dt_raw = idle_timer.getElapsedTimeAndResetF32();
 
+	// Service the WorkQueue we use for replies from worker threads.
+	// Use function statics for the timeslice setting so we only have to fetch
+	// and convert MainWorkTime once.
+	static F32 MainWorkTimeRaw = gSavedSettings.getF32("MainWorkTime");
+	static F32Milliseconds MainWorkTimeMs(MainWorkTimeRaw);
+	// MainWorkTime is specified in fractional milliseconds, but std::chrono
+	// uses integer representations. What if we want less than a microsecond?
+	// Use nanoseconds. We're very sure we will never need to specify a
+	// MainWorkTime that would be larger than we could express in
+	// std::chrono::nanoseconds.
+	static std::chrono::nanoseconds MainWorkTimeNanoSec{
+		std::chrono::nanoseconds::rep(MainWorkTimeMs.value() * 1000000)};
+	gMainloopWork.runFor(MainWorkTimeNanoSec);
+
 	// Cap out-of-control frame times
 	// Too low because in menus, swapping, debugger, etc.
 	// Too high because idle called with no objects in view, etc.
@@ -5226,20 +5240,6 @@ void LLAppViewer::idle()
 		}
 	}
 
-	// Service the WorkQueue we use for replies from worker threads.
-	// Use function statics for the timeslice setting so we only have to fetch
-	// and convert MainWorkTime once.
-	static F32 MainWorkTimeRaw = gSavedSettings.getF32("MainWorkTime");
-	static F32Milliseconds MainWorkTimeMs(MainWorkTimeRaw);
-	// MainWorkTime is specified in fractional milliseconds, but std::chrono
-	// uses integer representations. What if we want less than a microsecond?
-	// Use nanoseconds. We're very sure we will never need to specify a
-	// MainWorkTime that would be larger than we could express in
-	// std::chrono::nanoseconds.
-	static std::chrono::nanoseconds MainWorkTimeNanoSec{
-		std::chrono::nanoseconds::rep(MainWorkTimeMs.value() * 1000000)};
-	gMainloopWork.runFor(MainWorkTimeNanoSec);
-
 	// Handle shutdown process, for example,
 	// wait for floaters to close, send quit message,
 	// forcibly quit if it has taken too long
-- 
cgit v1.2.3