Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 7cf671b

Browse files
committed
Use correct token for task cancellation to work
1 parent e846129 commit 7cf671b

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/GitHub.Api/Git/Repository.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ private void HandleBranchCacheUpdatedEvent(CacheUpdateEvent cacheUpdateEvent)
382382

383383
private void RepositoryManagerOnCurrentBranchUpdated(ConfigBranch? branch, ConfigRemote? remote)
384384
{
385-
new ActionTask(CancellationToken.None, () => {
385+
new ActionTask(TaskManager.Instance.Token, () => {
386386
if (!Nullable.Equals(CurrentConfigBranch, branch))
387387
{
388388
var currentBranch = branch != null ? (GitBranch?)GetLocalGitBranch(branch.Value) : null;
@@ -403,7 +403,7 @@ private void RepositoryManagerOnCurrentBranchUpdated(ConfigBranch? branch, Confi
403403

404404
private void RepositoryManagerOnGitStatusUpdated(GitStatus gitStatus)
405405
{
406-
new ActionTask(CancellationToken.None, () => {
406+
new ActionTask(TaskManager.Instance.Token, () => {
407407
CurrentChanges = gitStatus.Entries;
408408
CurrentAhead = gitStatus.Ahead;
409409
CurrentBehind = gitStatus.Behind;
@@ -412,22 +412,22 @@ private void RepositoryManagerOnGitStatusUpdated(GitStatus gitStatus)
412412

413413
private void RepositoryManagerOnGitAheadBehindStatusUpdated(GitAheadBehindStatus aheadBehindStatus)
414414
{
415-
new ActionTask(CancellationToken.None, () => {
415+
new ActionTask(TaskManager.Instance.Token, () => {
416416
CurrentAhead = aheadBehindStatus.Ahead;
417417
CurrentBehind = aheadBehindStatus.Behind;
418418
}) { Affinity = TaskAffinity.UI }.Start();
419419
}
420420

421421
private void RepositoryManagerOnGitLogUpdated(List<GitLogEntry> gitLogEntries)
422422
{
423-
new ActionTask(CancellationToken.None, () => {
423+
new ActionTask(TaskManager.Instance.Token, () => {
424424
CurrentLog = gitLogEntries;
425425
}) { Affinity = TaskAffinity.UI }.Start();
426426
}
427427

428428
private void RepositoryManagerOnGitLocksUpdated(List<GitLock> gitLocks)
429429
{
430-
new ActionTask(CancellationToken.None, () => {
430+
new ActionTask(TaskManager.Instance.Token, () => {
431431
CurrentLocks = gitLocks;
432432
})
433433
{ Affinity = TaskAffinity.UI }.Start();
@@ -436,7 +436,7 @@ private void RepositoryManagerOnGitLocksUpdated(List<GitLock> gitLocks)
436436
private void RepositoryManagerOnRemoteBranchesUpdated(Dictionary<string, ConfigRemote> remotes,
437437
Dictionary<string, Dictionary<string, ConfigBranch>> branches)
438438
{
439-
new ActionTask(CancellationToken.None, () => {
439+
new ActionTask(TaskManager.Instance.Token, () => {
440440
cacheContainer.BranchCache.SetRemotes(remotes, branches);
441441
Remotes = ConfigRemotes.Values.Select(GetGitRemote).ToArray();
442442
RemoteBranches = RemoteConfigBranches.Values.SelectMany(x => x.Values).Select(GetRemoteGitBranch).ToArray();
@@ -445,7 +445,7 @@ private void RepositoryManagerOnRemoteBranchesUpdated(Dictionary<string, ConfigR
445445

446446
private void RepositoryManagerOnLocalBranchesUpdated(Dictionary<string, ConfigBranch> branches)
447447
{
448-
new ActionTask(CancellationToken.None, () => {
448+
new ActionTask(TaskManager.Instance.Token, () => {
449449
cacheContainer.BranchCache.SetLocals(branches);
450450
UpdateLocalBranches();
451451
}) { Affinity = TaskAffinity.UI }.Start();

src/GitHub.Api/Git/RepositoryManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public void UpdateLocks()
327327

328328
private ITask<T> HookupHandlers<T>(ITask<T> task, bool isExclusive, bool filesystemChangesExpected)
329329
{
330-
return new ActionTask(CancellationToken.None, () => {
330+
return new ActionTask(TaskManager.Instance.Token, () => {
331331
if (isExclusive)
332332
{
333333
Logger.Trace("Starting Operation - Setting Busy Flag");

src/tests/IntegrationTests/BaseGitEnvironmentTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public override void OnSetup()
5656
TestRepoMasterTwoRemotes = TestBasePath.Combine("IOTestsRepo", "IOTestsRepo_master_two_remotes");
5757

5858
Logger.Trace("Extracting Zip File to {0}", TestBasePath);
59-
ZipHelper.ExtractZipFile(TestZipFilePath, TestBasePath.ToString(), CancellationToken.None);
59+
ZipHelper.ExtractZipFile(TestZipFilePath, TestBasePath.ToString(), TaskManager.Token);
6060
Logger.Trace("Extracted Zip File");
6161
}
6262

src/tests/IntegrationTests/BasePlatformIntegrationTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ protected void InitializePlatform(NPath repoPath, NPath environmentPath, bool en
4040
var gitArchivePath = AssemblyResources.ToFile(ResourceType.Platform, "git.zip", zipArchivesPath, Environment);
4141
var gitLfsArchivePath = AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.zip", zipArchivesPath, Environment);
4242

43-
var gitInstaller = new GitInstaller(Environment, CancellationToken.None, installDetails, gitArchivePath, gitLfsArchivePath);
43+
var gitInstaller = new GitInstaller(Environment, TaskManager.Token, installDetails, gitArchivePath, gitLfsArchivePath);
4444

4545
NPath result = null;
4646
Exception ex = null;
4747

48-
gitInstaller.SetupGitIfNeeded(new ActionTask<NPath>(CancellationToken.None, (b, path) => {
48+
gitInstaller.SetupGitIfNeeded(new ActionTask<NPath>(TaskManager.Token, (b, path) => {
4949
result = path;
5050
autoResetEvent.Set();
5151
}),
52-
new ActionTask(CancellationToken.None, (b, exception) => {
52+
new ActionTask(TaskManager.Token, (b, exception) => {
5353
ex = exception;
5454
autoResetEvent.Set();
5555
}));

0 commit comments

Comments
 (0)