/// <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); } }
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)); }
private static async Task TestRateLimits(GitHubClient client, CloudStorageAccount storageAccount) { Console.WriteLine("Before"); await PrintRateLimits(client); var populator = new StoragePopulator(client, storageAccount.CreateCloudTableClient()); await populator.PopulateIssuesSince(SharedUtil.RepoId, DateTimeOffset.UtcNow - TimeSpan.FromHours(2)); Console.WriteLine("After"); await PrintRateLimits(client); }
private static async Task Misc(GitHubClient client, CloudStorageAccount account) { var util = new StoragePopulator(client, account.CreateCloudTableClient()); await util.PopulateMilestones(SharedUtil.RepoId); }