diff --git a/src/Agent.Plugins/Artifact/BuildServer.cs b/src/Agent.Plugins/Artifact/BuildServer.cs index 15a8d3f85d..808cb0395e 100644 --- a/src/Agent.Plugins/Artifact/BuildServer.cs +++ b/src/Agent.Plugins/Artifact/BuildServer.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +using Agent.Sdk.Knob; using System; using System.Collections.Generic; using System.Threading; @@ -18,8 +19,7 @@ public class BuildServer public BuildServer(VssConnection connection) { - connection.Settings.SendTimeout = TimeSpan.FromSeconds(300); - ArgUtil.NotNull(connection, nameof(connection)); + connection.Settings.SendTimeout = TimeSpan.FromSeconds(AgentKnobs.ArtifactAssociateTimeout.GetValue(UtilKnobValueContext.Instance()).AsInt()); _buildHttpClient = connection.GetClient(); } diff --git a/src/Agent.Sdk/Knob/AgentKnobs.cs b/src/Agent.Sdk/Knob/AgentKnobs.cs index 25ff9db01d..71eba87cd1 100644 --- a/src/Agent.Sdk/Knob/AgentKnobs.cs +++ b/src/Agent.Sdk/Knob/AgentKnobs.cs @@ -779,5 +779,12 @@ public class AgentKnobs "If true, agent will use sparse checkout in checkout task.", new RuntimeKnobSource("AGENT_USE_SPARSE_CHECKOUT_IN_CHECKOUT_TASK"), new BuiltInDefaultKnobSource("false")); + + // Artifact associate timeout for pipeline artifact. + public static readonly Knob ArtifactAssociateTimeout = new Knob( + nameof(ArtifactAssociateTimeout), + "Timeout for channel communication between agent listener and worker processes.", + new EnvironmentKnobSource("PIPELINE_ARTIFACT_ASSOCIATE_TIMEOUT"), + new BuiltInDefaultKnobSource("900")); // 15 * 60 - Setting the timeout to 15 minutes to account for slowness from azure storage and retries. } } diff --git a/src/Agent.Worker/Build/BuildServer.cs b/src/Agent.Worker/Build/BuildServer.cs index 50e09234e6..a81f5eff29 100644 --- a/src/Agent.Worker/Build/BuildServer.cs +++ b/src/Agent.Worker/Build/BuildServer.cs @@ -57,7 +57,7 @@ public async Task ConnectAsync(VssConnection jobConnection) } catch (Exception ex) when (attemptCount > 0) { - Trace.Info($"Catch exception during connect. {attemptCount} attemp left."); + Trace.Info($"Catch exception during connect. {attemptCount} attempt(s) left."); Trace.Error(ex); }