Skip to content

Commit 239eb6e

Browse files
Merge pull request SharePoint#4501 from wildcarrotsafari/patch-1
Prevent an infinite loop
2 parents 0ed89e7 + 8603663 commit 239eb6e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

docs/general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,21 @@ public static void ExecuteQueryWithIncrementalRetry(this ClientContext clientCon
202202
}
203203
else
204204
{
205-
// retry the previous request
205+
//increment the retry count
206+
retryAttempts++;
207+
208+
// retry the previous request using wrapper
206209
if (wrapper != null && wrapper.Value != null)
207210
{
208211
clientContext.RetryQuery(wrapper.Value);
209212
return;
210-
}
213+
}
214+
// retry the previous request as normal
215+
else
216+
{
217+
clientContext.ExecuteQuery();
218+
return;
219+
}
211220
}
212221
}
213222
catch (WebException ex)
@@ -237,8 +246,7 @@ public static void ExecuteQueryWithIncrementalRetry(this ClientContext clientCon
237246
// Delay for the requested seconds
238247
Thread.Sleep(retryAfterInterval * 1000);
239248

240-
// Increase counters
241-
retryAttempts++;
249+
// Increase counters
242250
backoffInterval = backoffInterval * 2;
243251
}
244252
else

0 commit comments

Comments
 (0)