SOLVED

PnP Retry behavior

Silver Contributor

I have a script using PnP and CSOM to update the time zone from a list of sites in a CSV file.  I got some errors like the following, the Connect-PnPOnline cmdlet appears to fail and then automatically retry. Is this expected behavior? if so, how many retries will it do?

@Erwin van Hunen

 

Title- travsave
TimeZoneID - 10
Connect-PnPOnline : The remote server returned an error: (404) Not Found.
At C:\Scripts\Premier\set-TimeZoneForSites.ps1:38 char:5
+     Connect-PnPOnline $siteUrl -UseWebLogin
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-PnPOnline], WebException
    + FullyQualifiedErrorId : System.Net.WebException,SharePointPnP.PowerShell.Commands.Base.ConnectOnline
 
Title- travsave
TimeZoneID - 10

1 Reply
best response confirmed by VI_Migration (Silver Contributor)
Solution

The Connect-PnPOnline cmdlet as such will not retry, but internal calls to the API -might- if there is a case of throttling. But only in case of throttling (server load too high). If the server sends a throttling exception the ExecuteQueryRetry call made in Core will try 10 times, the first time waiting 500 msecs, then 1000msec, then 2000msec, 4000msec etc. These values are specified in the Core library.

 

You can also set in PnP PowerShell a requirement for a certain server health score, and how many seconds it should wait before retrying and how many times it should retry. But that does not apply to the Connect-PnPOnline cmdlet itself but to other cmdlets used -after- connecting. These settings you make by specifying the MinimalHealthScore, RetryWait and RetryCount parameters.

1 best response

Accepted Solutions
best response confirmed by VI_Migration (Silver Contributor)
Solution

The Connect-PnPOnline cmdlet as such will not retry, but internal calls to the API -might- if there is a case of throttling. But only in case of throttling (server load too high). If the server sends a throttling exception the ExecuteQueryRetry call made in Core will try 10 times, the first time waiting 500 msecs, then 1000msec, then 2000msec, 4000msec etc. These values are specified in the Core library.

 

You can also set in PnP PowerShell a requirement for a certain server health score, and how many seconds it should wait before retrying and how many times it should retry. But that does not apply to the Connect-PnPOnline cmdlet itself but to other cmdlets used -after- connecting. These settings you make by specifying the MinimalHealthScore, RetryWait and RetryCount parameters.

View solution in original post