Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2581 from jackpoz/create-site-logging
Browse files Browse the repository at this point in the history
Improve logging when waiting for a site collection to be created
  • Loading branch information
jansenbe authored Mar 16, 2020
2 parents e5467a8 + ec37c9a commit 901150a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Core/OfficeDevPnP.Core/Sites/SiteCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -530,12 +530,22 @@ private static void WaitForProvisioningIsComplete(Web web, int maxRetryCount = 8
// Catch this...sometimes there's that "sharepoint push feature has not been ..." error
}

// Let's start polling for completion. We'll wait maximum 20 minutes for completion.
// Let's start polling for completion. We'll wait maximum 20 minutes for completion.

Log.Debug(Constants.LOGGING_SOURCE, $"Starting to wait for site collection to be created");

var stopwatch = new Stopwatch();
stopwatch.Start();

var retryAttempt = 1;
do
{
Log.Debug(Constants.LOGGING_SOURCE, $"Elapsed: {stopwatch.Elapsed.ToString(@"mm\:ss\.fff")} | Attempt {retryAttempt}/{maxRetryCount}");

if (retryAttempt > 1)
{
Log.Debug(Constants.LOGGING_SOURCE, $"Elapsed: {stopwatch.Elapsed.ToString(@"mm\:ss\.fff")} | Waiting {retryDelay / 1000} seconds");

System.Threading.Thread.Sleep(retryDelay);
}

Expand All @@ -557,6 +567,9 @@ private static void WaitForProvisioningIsComplete(Web web, int maxRetryCount = 8
}
}
while (!isProvisioningComplete && retryAttempt <= maxRetryCount);

stopwatch.Stop();
Log.Debug(Constants.LOGGING_SOURCE, $"Elapsed: {stopwatch.Elapsed.ToString(@"mm\:ss\.fff")} | Finished");
}
catch (Exception)
{
Expand Down

0 comments on commit 901150a

Please sign in to comment.