Skip to content

Commit

Permalink
Better cancellation handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pmiossec committed Sep 14, 2023
1 parent c5bc5b3 commit 10f1e4c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions GitCommands/Git/GitModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2162,10 +2162,19 @@ public IReadOnlyList<PatchFile> GetInteractiveRebasePatchFiles()
bool isCurrentFound = false;

RevisionReader reader = new(this, hasReflogSelector: false, allBodies: true);
CancellationTokenSource cts = new(TimeSpan.FromSeconds(15));
Dictionary<string, GitRevision> rebasedCommitsRevisions
= reader.GetRevisionsFromRange(todoCommitsInfos[0][1], todoCommitsInfos[^1][1], cts.Token)
CancellationTokenSource cts = new(TimeSpan.FromSeconds(30));
Dictionary<string, GitRevision> rebasedCommitsRevisions;

try
{
rebasedCommitsRevisions = reader.GetRevisionsFromRange(todoCommitsInfos[0][1], todoCommitsInfos[^1][1], cts.Token)
.ToDictionary(r => r.Guid, r => r);
}
catch (OperationCanceledException)
{
// If retrieve of commit range failed, fall back on getting data commit by commit
rebasedCommitsRevisions = new Dictionary<string, GitRevision>();
}

foreach (string[] parts in todoCommitsInfos)
{
Expand Down

0 comments on commit 10f1e4c

Please sign in to comment.