/// <summary> /// Milestone information still does not come down as a part of events. This function catches these types of /// update by doing a 'since' query on GitHub and bulk updating all of the changed values. /// </summary> public static async Task GithubPopulateIssuesSince( [TimerTrigger("0 0/1 * * * *")] TimerInfo timerInfo, [Table(TableNames.RoachIssueTable)] CloudTable issueTable, [Table(TableNames.RoachMilestoneTable)] CloudTable milestoneTable, [Table(TableNames.RoachStatusTable)] CloudTable statusTable, TextWriter logger, CancellationToken cancellationToken) { var client = SharedUtil.CreateGitHubClient(); var storagePopulator = new StoragePopulator(client, issueTable, milestoneTable); // TODO: Need to make this adaptable to all repos, not just dotnet/roslyn var allRepos = new[] { SharedUtil.RepoId }; foreach (var repo in allRepos) { var statusEntity = await AzureUtil.QueryAsync <RoachStatusEntity>(statusTable, RoachStatusEntity.GetEntityKey(repo), cancellationToken); if (statusEntity == null || statusEntity.LastBulkUpdate.Value == null) { logger.WriteLine($"Repo {repo.Owner}/{repo.Name} does not have a status entry. Cannot do a since update."); return; } var before = DateTimeOffset.UtcNow; await storagePopulator.PopulateIssuesSince(repo, statusEntity.LastBulkUpdate.Value, cancellationToken); // Given there are no events for milestones need to do a bulk update here. await storagePopulator.PopulateMilestones(repo, cancellationToken); statusEntity.SetLastBulkUpdate(before); await statusTable.ExecuteAsync(TableOperation.Replace(statusEntity), cancellationToken); } }
internal static async Task <int> Go() { try { var client = SharedUtil.CreateGitHubClient(); var storageAccount = SharedUtil.CreateStorageAccount(); AzureUtil.EnsureAzureResources(storageAccount); // await DumpHooks(client); // await DumpMilestones(client); // await PrintRateLimits(client); // await TestRateLimits(client, storageAccount); await PopulateSince(); // await FixNulls(storageAccount); // await DumpSince(client); // await InitRepo(client, storageAccount, SharedUtil.RepoId); // await Misc(client, storageAccount); return(0); } catch (Exception ex) { Console.Write($"{ex.Message}"); return(1); } }
private static async Task PopulateSince() { var storageAccount = SharedUtil.CreateStorageAccount(); var client = SharedUtil.CreateGitHubClient(); var populator = new StoragePopulator(client, storageAccount.CreateCloudTableClient()); await populator.PopulateIssuesSince( new RoachRepoId("dotnet", "roslyn"), DateTimeOffset.UtcNow.AddDays(-7)); }
private static async Task PopulateSince() { var storageAccount = SharedUtil.CreateStorageAccount(); var client = SharedUtil.CreateGitHubClient(); var populator = new StoragePopulator(client, storageAccount.CreateCloudTableClient()); await populator.PopulateIssuesSince( new RoachRepoId("dotnet", "roslyn"), new DateTimeOffset(year : 2015, month : 1, day : 1, hour : 0, minute : 0, second : 0, offset : TimeSpan.Zero)); }