summaryrefslogtreecommitdiff
path: root/indra/newview/llaisapi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llaisapi.cpp')
-rw-r--r--indra/newview/llaisapi.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index 9c76f56ef3..f67f2688a1 100644
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -1019,6 +1019,9 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht
}
//-------------------------------------------------------------------------
+U32 AISUpdate::sBatchFrameCount = 0;
+LLTimer AISUpdate::sBatchTimer;
+
AISUpdate::AISUpdate(const LLSD& update, AISAPI::COMMAND_TYPE type, const LLSD& request_body)
: mType(type)
{
@@ -1036,8 +1039,16 @@ AISUpdate::AISUpdate(const LLSD& update, AISAPI::COMMAND_TYPE type, const LLSD&
mFetchDepth = request_body["depth"].asInteger();
}
- mTimer.setTimerExpirySec(AIS_EXPIRY_SECONDS);
- mTimer.start();
+ mTaskTimer.setTimerExpirySec(AIS_TASK_EXPIRY_SECONDS);
+ mTaskTimer.start();
+
+ U32 current_frame = LLFrameTimer::getFrameCount();
+ if (sBatchFrameCount != current_frame)
+ {
+ sBatchTimer.setTimerExpirySec(AIS_BATCH_EXPIRY_SECONDS);
+ sBatchTimer.start();
+ sBatchFrameCount = current_frame;
+ }
parseUpdate(update);
}
@@ -1058,7 +1069,7 @@ void AISUpdate::clearParseResults()
void AISUpdate::checkTimeout()
{
- if (mTimer.hasExpired())
+ if (mTaskTimer.hasExpired() || sBatchTimer.hasExpired())
{
// If we are taking too long, don't starve other tasks,
// yield to mainloop.
@@ -1067,7 +1078,16 @@ void AISUpdate::checkTimeout()
// a chance, so wait for a frame tick instead.
llcoro::suspendUntilNextFrame();
LLCoros::checkStop();
- mTimer.setTimerExpirySec(AIS_EXPIRY_SECONDS);
+ mTaskTimer.setTimerExpirySec(AIS_TASK_EXPIRY_SECONDS);
+
+ U32 current_frame = LLFrameTimer::getFrameCount();
+ if (sBatchFrameCount != current_frame)
+ {
+ // To give other tasks a chance batch timer
+ // has a longer delay.
+ sBatchTimer.setTimerExpirySec(AIS_BATCH_EXPIRY_SECONDS);
+ sBatchFrameCount = current_frame;
+ }
}
}