summary refs log tree commit diff
path: root/LibGitTest/Test2.cs
diff options
context:
space:
mode:
Diffstat (limited to 'LibGitTest/Test2.cs')
-rw-r--r--LibGitTest/Test2.cs23
1 files changed, 11 insertions, 12 deletions
diff --git a/LibGitTest/Test2.cs b/LibGitTest/Test2.cs

index c25f9b0..46337e6 100644 --- a/LibGitTest/Test2.cs +++ b/LibGitTest/Test2.cs
@@ -6,23 +6,22 @@ public class Test2 { public static async Task Run() { + return; + Console.WriteLine("Test2 running"); List<CommitObject> commits = new(); List<GitRef> heads = new(); - var repo = new GitRepo(new WebRepoSource("https://git.rory.gay/.fosscord/fosscord-server.git/") - { - }); + var repo = new GitRepo(new WebRepoSource("https://git.rory.gay/.fosscord/fosscord-server.git/")); + + var ss = new SemaphoreSlim(12, 12); - var ss = new SemaphoreSlim(12,12); - var _heads = repo.GetRefs().GetAsyncEnumerator(); while (await _heads.MoveNextAsync()) { heads.Add(_heads.Current); var isCached = await ((WebRepoSource)repo.RepoSource).HasObjectCached(_heads.Current.CommitId); - Console.WriteLine(_heads.Current.Name+ " - cache miss: " + !isCached); + Console.WriteLine(_heads.Current.Name + " - cache miss: " + !isCached); if (!isCached) { - var _c = _heads.Current.CommitId; #pragma warning disable CS4014 Task.Run(async () => @@ -34,7 +33,7 @@ public class Test2 { }).GetCommits(_c).GetAsyncEnumerator(); while ( - await a.MoveNextAsync() + await a.MoveNextAsync() && !await ((WebRepoSource)repo.RepoSource) .HasObjectCached(a.Current.CommitId) ) Console.WriteLine($"Prefetched commit {a.Current.CommitId} with {a.Current.ParentIds.Count()} parents"); @@ -43,9 +42,9 @@ public class Test2 }); } } - - var log = repo.GetCommits(heads.First(x=>x.Name == "refs/heads/master").CommitId).GetAsyncEnumerator(); + + var log = repo.GetCommits(heads.First(x => x.Name == "refs/heads/master").CommitId).GetAsyncEnumerator(); while (await log.MoveNextAsync()) { commits.Add(log.Current); @@ -54,8 +53,8 @@ public class Test2 // StateHasChanged(); await Task.Delay(1); } - - Console.WriteLine($"Fetched in-log commit {log.Current.CommitId}, {12-ss.CurrentCount} tasks running"); + + Console.WriteLine($"Fetched in-log commit {log.Current.CommitId}, {12 - ss.CurrentCount} tasks running"); if (ss.CurrentCount == 12) {