Skip to content

Commit

Permalink
Increase timeout for artifact associate for pipeline artifact (#5109)
Browse files Browse the repository at this point in the history
* Increase the timeout for artifact associate for pipeline artifact.

* Don't know how this was modified

* Add a knob

* forgot the using
  • Loading branch information
fadnavistanmay authored Feb 10, 2025
1 parent 6bee6b7 commit 9980295
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Agent.Plugins/Artifact/BuildServer.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<BuildHttpClient>();
}

Expand Down
7 changes: 7 additions & 0 deletions src/Agent.Sdk/Knob/AgentKnobs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}
2 changes: 1 addition & 1 deletion src/Agent.Worker/Build/BuildServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 9980295

Please sign in to comment.