@@ -216,6 +216,8 @@ public void OverrideCertificateHandler(CertificateHandler certificateHandler)
216
216
217
217
private Dictionary < string , LootLockerHTTPExecutionQueueItem > HTTPExecutionQueue = new Dictionary < string , LootLockerHTTPExecutionQueueItem > ( ) ;
218
218
private List < string > CompletedRequestIDs = new List < string > ( ) ;
219
+ private List < string > ExecutionItemsNeedingRefresh = new List < string > ( ) ;
220
+ private List < string > OngoingIdsToCleanUp = new List < string > ( ) ;
219
221
220
222
private void OnDestroy ( )
221
223
{
@@ -230,13 +232,14 @@ private void OnDestroy()
230
232
231
233
void Update ( )
232
234
{
233
- List < string > ExecutionItemsNeedingRefresh = new List < string > ( ) ;
234
- foreach ( var executionItem in HTTPExecutionQueue . Values )
235
+ ExecutionItemsNeedingRefresh . Clear ( ) ;
236
+ // Process the execution queue
237
+ foreach ( var executionItem in HTTPExecutionQueue . Values )
235
238
{
236
239
// Skip completed requests
237
- if ( executionItem . Done )
240
+ if ( executionItem . Done )
238
241
{
239
- if ( ! CompletedRequestIDs . Contains ( executionItem . RequestData . RequestId ) )
242
+ if ( ! CompletedRequestIDs . Contains ( executionItem . RequestData . RequestId ) )
240
243
{
241
244
CompletedRequestIDs . Add ( executionItem . RequestData . RequestId ) ;
242
245
}
@@ -252,7 +255,7 @@ void Update()
252
255
// Send unsent
253
256
if ( executionItem . AsyncOperation == null && executionItem . WebRequest == null )
254
257
{
255
- if ( executionItem . RetryAfter != null && executionItem . RetryAfter > DateTime . Now )
258
+ if ( executionItem . RetryAfter != null && executionItem . RetryAfter > DateTime . Now )
256
259
{
257
260
// Wait for retry
258
261
continue ;
@@ -271,13 +274,13 @@ void Update()
271
274
// Process ongoing
272
275
var Result = ProcessOngoingRequest ( executionItem ) ;
273
276
274
- if ( Result == HTTPExecutionQueueProcessingResult . NeedsSessionRefresh )
277
+ if ( Result == HTTPExecutionQueueProcessingResult . NeedsSessionRefresh )
275
278
{
276
279
//Bulk handle session refreshes at the end
277
280
ExecutionItemsNeedingRefresh . Add ( executionItem . RequestData . RequestId ) ;
278
281
continue ;
279
282
}
280
- else if ( Result == HTTPExecutionQueueProcessingResult . WaitForNextTick || Result == HTTPExecutionQueueProcessingResult . None )
283
+ else if ( Result == HTTPExecutionQueueProcessingResult . WaitForNextTick || Result == HTTPExecutionQueueProcessingResult . None )
281
284
{
282
285
// Nothing to handle, simply continue
283
286
continue ;
@@ -402,11 +405,11 @@ private void LateUpdate()
402
405
CompletedRequestIDs . Add ( ExecutionItem . RequestData . RequestId ) ;
403
406
}
404
407
}
405
-
406
- List < string > OngoingIdsToCleanUp = new List < string > ( ) ;
407
- foreach ( string OngoingId in CurrentlyOngoingRequests . Keys )
408
+
409
+ OngoingIdsToCleanUp . Clear ( ) ;
410
+ foreach ( string OngoingId in CurrentlyOngoingRequests . Keys )
408
411
{
409
- if ( ! HTTPExecutionQueue . TryGetValue ( OngoingId , out var executionQueueItem ) || executionQueueItem . Done )
412
+ if ( ! HTTPExecutionQueue . TryGetValue ( OngoingId , out var executionQueueItem ) || executionQueueItem . Done )
410
413
{
411
414
OngoingIdsToCleanUp . Add ( OngoingId ) ;
412
415
}
0 commit comments