From 92e467acc1dce8ba809114362b48cc76875a668b Mon Sep 17 00:00:00 2001 From: Kevin Jones Date: Sat, 11 May 2024 14:51:49 -0400 Subject: [PATCH] Set a default MDOP --- src/AzureSignTool/Program.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/AzureSignTool/Program.cs b/src/AzureSignTool/Program.cs index 193ef92..daa71c3 100644 --- a/src/AzureSignTool/Program.cs +++ b/src/AzureSignTool/Program.cs @@ -79,7 +79,7 @@ internal sealed class SignCommand : Command internal bool NoPageHashing { get; set; } internal bool ContinueOnError { get; set; } internal string? InputFileList { get; set; } - internal int? MaxDegreeOfParallelism { get; set; } + internal int MaxDegreeOfParallelism { get; set; } = 4; internal bool Colors { get; set; } internal bool SkipSignedFiles { get; set; } internal bool AppendSignature { get; set; } @@ -266,9 +266,9 @@ private async ValueTask RunSign() logger.LogInformation("Cancelling signing operations."); }; var options = new ParallelOptions(); - if (MaxDegreeOfParallelism.HasValue) + if (MaxDegreeOfParallelism != 0) { - options.MaxDegreeOfParallelism = MaxDegreeOfParallelism.Value; + options.MaxDegreeOfParallelism = MaxDegreeOfParallelism; } logger.LogTrace("Creating context"); @@ -453,9 +453,9 @@ private bool ValidateArguments(CommandRunContext context) valid &= ValidateHashAlgorithm(context, FileDigestAlgorithm, "--file-digest"); valid &= ValidateHashAlgorithm(context, TimestampDigestAlgorithm, "--timestamp-digest"); - if (MaxDegreeOfParallelism is < -1 or 0) + if (MaxDegreeOfParallelism < -1) { - context.Error.WriteLine("'--max-degree-of-parallelism' must be a positive interger, or negative one."); + context.Error.WriteLine("'--max-degree-of-parallelism' must be a positive interger, zero, or -1."); valid = false; }