Skip to content

Commit

Permalink
Replace UpdateFileFacade loop with Parallel.ForEach
Browse files Browse the repository at this point in the history
  • Loading branch information
MBroholmA committed Aug 31, 2024
1 parent 1011c56 commit 774a3b8
Show file tree
Hide file tree
Showing 2 changed files with 331 additions and 219 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using WixToolset.Data;
using WixToolset.Data.Symbols;
using WixToolset.Data.WindowsInstaller;
Expand Down Expand Up @@ -50,6 +51,8 @@ public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBa
this.PatchSubStorages = patchSubStorages;

this.BackendExtensions = backendExtension;

this.CancellationToken = context.CancellationToken;
}

private IServiceProvider ServiceProvider { get; }
Expand Down Expand Up @@ -100,6 +103,8 @@ public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBa

private string IntermediateFolder { get; }

private CancellationToken CancellationToken { get; }

public IBindResult Execute()
{
if (!this.Intermediate.HasLevel(Data.IntermediateLevels.Linked) || !this.Intermediate.HasLevel(Data.IntermediateLevels.Resolved))
Expand Down Expand Up @@ -275,7 +280,7 @@ public IBindResult Execute()

// Gather information about files that do not come from merge modules.
{
var command = new UpdateFileFacadesCommand(this.Messaging, this.FileSystem, section, allFileFacades, fileFacadesFromIntermediate, variableCache, overwriteHash: true);
var command = new UpdateFileFacadesCommand(this.Messaging, this.FileSystem, section, allFileFacades, fileFacadesFromIntermediate, variableCache, overwriteHash: true, this.CancellationToken);
command.Execute();
}

Expand Down Expand Up @@ -319,7 +324,7 @@ public IBindResult Execute()
{
var updatedFacades = reresolvedFiles.Select(f => allFileFacades.First(ff => ff.Id == f.Id?.Id));

var command = new UpdateFileFacadesCommand(this.Messaging, this.FileSystem, section, allFileFacades, updatedFacades, variableCache, overwriteHash: false);
var command = new UpdateFileFacadesCommand(this.Messaging, this.FileSystem, section, allFileFacades, updatedFacades, variableCache, overwriteHash: false, this.CancellationToken);
command.Execute();
}
}
Expand Down
Loading

0 comments on commit 774a3b8

Please sign in to comment.