Skip to content

Commit 9980295

Browse files
Increase timeout for artifact associate for pipeline artifact (#5109)
* Increase the timeout for artifact associate for pipeline artifact. * Don't know how this was modified * Add a knob * forgot the using
1 parent 6bee6b7 commit 9980295

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/Agent.Plugins/Artifact/BuildServer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
using Agent.Sdk.Knob;
45
using System;
56
using System.Collections.Generic;
67
using System.Threading;
@@ -18,8 +19,7 @@ public class BuildServer
1819

1920
public BuildServer(VssConnection connection)
2021
{
21-
connection.Settings.SendTimeout = TimeSpan.FromSeconds(300);
22-
ArgUtil.NotNull(connection, nameof(connection));
22+
connection.Settings.SendTimeout = TimeSpan.FromSeconds(AgentKnobs.ArtifactAssociateTimeout.GetValue(UtilKnobValueContext.Instance()).AsInt());
2323
_buildHttpClient = connection.GetClient<BuildHttpClient>();
2424
}
2525

src/Agent.Sdk/Knob/AgentKnobs.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,5 +779,12 @@ public class AgentKnobs
779779
"If true, agent will use sparse checkout in checkout task.",
780780
new RuntimeKnobSource("AGENT_USE_SPARSE_CHECKOUT_IN_CHECKOUT_TASK"),
781781
new BuiltInDefaultKnobSource("false"));
782+
783+
// Artifact associate timeout for pipeline artifact.
784+
public static readonly Knob ArtifactAssociateTimeout = new Knob(
785+
nameof(ArtifactAssociateTimeout),
786+
"Timeout for channel communication between agent listener and worker processes.",
787+
new EnvironmentKnobSource("PIPELINE_ARTIFACT_ASSOCIATE_TIMEOUT"),
788+
new BuiltInDefaultKnobSource("900")); // 15 * 60 - Setting the timeout to 15 minutes to account for slowness from azure storage and retries.
782789
}
783790
}

src/Agent.Worker/Build/BuildServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public async Task ConnectAsync(VssConnection jobConnection)
5757
}
5858
catch (Exception ex) when (attemptCount > 0)
5959
{
60-
Trace.Info($"Catch exception during connect. {attemptCount} attemp left.");
60+
Trace.Info($"Catch exception during connect. {attemptCount} attempt(s) left.");
6161
Trace.Error(ex);
6262
}
6363

0 commit comments

Comments
 (0)