@@ -1019,6 +1019,9 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht
10191019}
10201020
10211021// -------------------------------------------------------------------------
1022+ U32 AISUpdate::sBatchFrameCount = 0 ;
1023+ LLTimer AISUpdate::sBatchTimer ;
1024+
10221025AISUpdate::AISUpdate (const LLSD& update, AISAPI::COMMAND_TYPE type, const LLSD& request_body)
10231026: mType(type)
10241027{
@@ -1036,8 +1039,16 @@ AISUpdate::AISUpdate(const LLSD& update, AISAPI::COMMAND_TYPE type, const LLSD&
10361039 mFetchDepth = request_body[" depth" ].asInteger ();
10371040 }
10381041
1039- mTimer .setTimerExpirySec (AIS_EXPIRY_SECONDS);
1040- mTimer .start ();
1042+ mTaskTimer .setTimerExpirySec (AIS_TASK_EXPIRY_SECONDS);
1043+ mTaskTimer .start ();
1044+
1045+ U32 current_frame = LLFrameTimer::getFrameCount ();
1046+ if (sBatchFrameCount != current_frame)
1047+ {
1048+ sBatchTimer .setTimerExpirySec (AIS_BATCH_EXPIRY_SECONDS);
1049+ sBatchTimer .start ();
1050+ sBatchFrameCount = current_frame;
1051+ }
10411052 parseUpdate (update);
10421053}
10431054
@@ -1058,7 +1069,7 @@ void AISUpdate::clearParseResults()
10581069
10591070void AISUpdate::checkTimeout ()
10601071{
1061- if (mTimer .hasExpired ())
1072+ if (mTaskTimer . hasExpired () || sBatchTimer .hasExpired ())
10621073 {
10631074 // If we are taking too long, don't starve other tasks,
10641075 // yield to mainloop.
@@ -1067,7 +1078,16 @@ void AISUpdate::checkTimeout()
10671078 // a chance, so wait for a frame tick instead.
10681079 llcoro::suspendUntilNextFrame ();
10691080 LLCoros::checkStop ();
1070- mTimer .setTimerExpirySec (AIS_EXPIRY_SECONDS);
1081+ mTaskTimer .setTimerExpirySec (AIS_TASK_EXPIRY_SECONDS);
1082+
1083+ U32 current_frame = LLFrameTimer::getFrameCount ();
1084+ if (sBatchFrameCount != current_frame)
1085+ {
1086+ // To give other tasks a chance batch timer
1087+ // has a longer delay.
1088+ sBatchTimer .setTimerExpirySec (AIS_BATCH_EXPIRY_SECONDS);
1089+ sBatchFrameCount = current_frame;
1090+ }
10711091 }
10721092}
10731093
0 commit comments