public async Task ExecuteAsync(BaseSchema baseSchema, string manifest, string filePath) { var exponentialBackoffFactor = 5000; var retryCount = 1; await ExecutionSupports.Retry(async() => { await ExecuteCoreAsync(baseSchema, manifest, filePath); }, exception => { Insights.TrackException(exception); }, exponentialBackoffFactor, retryCount); }
public async Task ExecuteAsync() { var exponentialBackoffFactor = 5000; var retryCount = 1; await ExecutionSupports.Retry(async() => { await ExecuteCoreAsync(); }, exception => { Insights.TrackException(exception); }, exponentialBackoffFactor, retryCount); }
protected async override Task <bool> MigrateItemAsync(SingleMigrationWorkItem migrationItem) { var sucessFlag = false; var exponentialBackoffFactor = 5000; var retryCount = 3; await ExecutionSupports.Retry(async() => { await client.UpdateWorkItemFieldsAsync(migrationItem.WorkItemRef.Id, migrationItem.Fields); Insights.Trace($"{migrationItem.WorkItemRef.Id}", migrationItem.Fields); Insights.Debug("$Migrated item: {migrationItem.WorkItemRef.Id}"); sucessFlag = true; }, exception => { Insights.TrackException(exception); sucessFlag = false; }, exponentialBackoffFactor, retryCount); return(sucessFlag); }
private async Task EnsureRepositoriesExistsAsync( ProjectManifest manifest, Waddle.AdoConnectionFactory factory, Waddle.RepositoryService repoService, Waddle.Dtos.Project project, bool projectWasAbsent) { if (project != null && manifest.Repositories != null && manifest.Repositories.Any()) { foreach (var repo in manifest.Repositories) { if (!string.IsNullOrWhiteSpace(repo.Name)) { var reposCollection = await repoService.GetRepositoryListAsync(project.Id); var repository = reposCollection .FirstOrDefault(r => r.Name.Equals(repo.Name, StringComparison.OrdinalIgnoreCase)); if (repository == null) { Logger.StatusBegin($"Creating Repository {repo.Name}..."); await ExecutionSupports.Retry(async() => { repository = await repoService.CreateAsync(project.Id, repo.Name); }, exception => { Logger.SilentError(exception.Message); }); Logger.StatusEndSuccess("Succeed"); } Logger.StatusBegin($"Setting up permissions for repository {repo.Name}..."); await EnsureRepositoryPermissionsAsync(factory, project, repo, repository); Logger.StatusEndSuccess("Succeed"); } } await DeleteDefaultRepoAsync(repoService, project, projectWasAbsent); } }
protected async Task EnsureRepositoriesExistsAsync( ProjectManifest manifest, RepositoryService repoService, Kdoctl.CliServices.AzDoServices.Dtos.Project project, bool projectWasAbsent) { if (project != null && manifest.Repositories != null && manifest.Repositories.Any()) { foreach (var repo in manifest.Repositories) { if (!string.IsNullOrWhiteSpace(repo.Name)) { var reposCollection = await repoService.GetRepositoryListAsync(project.Id); var repository = reposCollection .FirstOrDefault(r => r.Name.Equals(repo.Name, StringComparison.OrdinalIgnoreCase)); if (repository == null) { using var op = Insights.BeginOperation($"Creating Repository {repo.Name}...", "Repository"); await ExecutionSupports.Retry(async() => { repository = await repoService.CreateAsync(project.Id, repo.Name); }, exception => { Insights.TrackException(exception); }); op.EndWithSuccess("Succeed"); } using var opPermissions = Insights.BeginOperation($"Setting up permissions for repository {repo.Name}...", "RepoPermissions"); await EnsureRepositoryPermissionsAsync(project, repo, repository); } } await DeleteDefaultRepoAsync(repoService, project, projectWasAbsent); } }