diff --git a/src/Capgemini.PowerApps.PackageDeployerTemplate/Adapters/CrmServiceAdapter.cs b/src/Capgemini.PowerApps.PackageDeployerTemplate/Adapters/CrmServiceAdapter.cs index 182cea8..e3c5f9e 100644 --- a/src/Capgemini.PowerApps.PackageDeployerTemplate/Adapters/CrmServiceAdapter.cs +++ b/src/Capgemini.PowerApps.PackageDeployerTemplate/Adapters/CrmServiceAdapter.cs @@ -316,18 +316,18 @@ public TResponse Execute(OrganizationRequest request, string username } /// - public bool HasStartedSolutionHistoryRecords(ILogger logger) + public void WaitForSolutionHistoryRecordsToComplete(ILogger logger) { var retryPolicy = Policy - .HandleResult(hasActiveRecords => !hasActiveRecords) + .HandleResult(hasActiveRecords => hasActiveRecords) .WaitAndRetryForever( sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(20), onRetry: (result, timeSpan) => { - logger.LogInformation($"Active records still present within Solution History. Waiting for {timeSpan.TotalSeconds} seconds before retrying..."); + logger.LogInformation($"Active records are still present within Solution History. Waiting for {timeSpan.TotalSeconds} seconds before retrying."); }); - var result = retryPolicy.Execute(() => + retryPolicy.Execute(() => { var entityCollection = this.crmSvc.RetrieveMultiple(new QueryByAttribute() { @@ -347,8 +347,6 @@ public bool HasStartedSolutionHistoryRecords(ILogger logger) }); return entityCollection.TotalRecordCount > 0; }); - - return result; } /// @@ -362,7 +360,7 @@ public ExecuteMultipleResponse ExecuteMultipleSolutionHistoryOperation(IEnumerab sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(10), onRetry: (ex, timeSpan) => { - this.HasStartedSolutionHistoryRecords(logger); + this.WaitForSolutionHistoryRecordsToComplete(logger); }); retryPolicy.Execute(() => diff --git a/src/Capgemini.PowerApps.PackageDeployerTemplate/Adapters/ICrmServiceAdapter.cs b/src/Capgemini.PowerApps.PackageDeployerTemplate/Adapters/ICrmServiceAdapter.cs index 2a634c7..dd250e0 100644 --- a/src/Capgemini.PowerApps.PackageDeployerTemplate/Adapters/ICrmServiceAdapter.cs +++ b/src/Capgemini.PowerApps.PackageDeployerTemplate/Adapters/ICrmServiceAdapter.cs @@ -123,11 +123,10 @@ public TResponse Execute(OrganizationRequest request, string username string GetEntityTypeCode(string entityLogicalName); /// - /// Checks whether there are any Solution History records in a Started state. + /// Waits for Solution History records in a Started state to complete. /// /// Instane of ILogger. - /// Returns true if active records are present in the Solution History; otherwise, returns false. - bool HasStartedSolutionHistoryRecords(ILogger logger); + void WaitForSolutionHistoryRecordsToComplete(ILogger logger); /// /// Executes multiple requests and performs a check on the Solution History during the operation.