Skip to content

Commit d296014

Browse files
Remove USE_BROKER_FLOW (actions#3162)
1 parent 3449d5f commit d296014

File tree

5 files changed

+11
-45
lines changed

5 files changed

+11
-45
lines changed

src/Runner.Common/BrokerServer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public Task<TaskAgentMessage> GetRunnerMessageAsync(Guid? sessionId, TaskAgentSt
6363
var brokerSession = RetryRequest<TaskAgentMessage>(
6464
async () => await _brokerHttpClient.GetRunnerMessageAsync(sessionId, version, status, os, architecture, disableUpdate, cancellationToken), cancellationToken, shouldRetry: ShouldRetryException);
6565

66+
6667
return brokerSession;
6768
}
6869

src/Runner.Listener/MessageListener.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,19 +205,17 @@ public async Task DeleteSessionAsync()
205205

206206
public void OnJobStatus(object sender, JobStatusEventArgs e)
207207
{
208-
if (StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable("USE_BROKER_FLOW")))
208+
Trace.Info("Received job status event. JobState: {0}", e.Status);
209+
runnerStatus = e.Status;
210+
try
209211
{
210-
Trace.Info("Received job status event. JobState: {0}", e.Status);
211-
runnerStatus = e.Status;
212-
try
213-
{
214-
_getMessagesTokenSource?.Cancel();
215-
}
216-
catch (ObjectDisposedException)
217-
{
218-
Trace.Info("_getMessagesTokenSource is already disposed.");
219-
}
212+
_getMessagesTokenSource?.Cancel();
213+
}
214+
catch (ObjectDisposedException)
215+
{
216+
Trace.Info("_getMessagesTokenSource is already disposed.");
220217
}
218+
221219
}
222220

223221
public async Task<TaskAgentMessage> GetNextMessageAsync(CancellationToken token)

src/Runner.Sdk/Util/VssUtil.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ public static VssConnection CreateConnection(
8585
settings.SendTimeout = TimeSpan.FromSeconds(Math.Min(Math.Max(httpRequestTimeoutSeconds, 100), 1200));
8686
}
8787

88-
if (StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable("USE_BROKER_FLOW")))
89-
{
90-
settings.AllowAutoRedirectForBroker = true;
91-
}
92-
9388
// Remove Invariant from the list of accepted languages.
9489
//
9590
// The constructor of VssHttpRequestSettings (base class of VssClientHttpRequestSettings) adds the current

src/Sdk/Common/Common/VssHttpMessageHandler.cs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -214,25 +214,7 @@ protected override async Task<HttpResponseMessage> SendAsync(
214214
// ConfigureAwait(false) enables the continuation to be run outside any captured
215215
// SyncronizationContext (such as ASP.NET's) which keeps things from deadlocking...
216216

217-
var tmpResponse = await m_messageInvoker.SendAsync(request, tokenSource.Token).ConfigureAwait(false);
218-
if (Settings.AllowAutoRedirectForBroker && tmpResponse.StatusCode == HttpStatusCode.Redirect)
219-
{
220-
//Dispose of the previous response
221-
tmpResponse?.Dispose();
222-
223-
var location = tmpResponse.Headers.Location;
224-
request = new HttpRequestMessage(HttpMethod.Get, location);
225-
226-
// Reapply the token to new redirected request
227-
ApplyToken(request, token, applyICredentialsToWebProxy: lastResponseDemandedProxyAuth);
228-
229-
// Resend the request
230-
response = await m_messageInvoker.SendAsync(request, tokenSource.Token).ConfigureAwait(false);
231-
}
232-
else
233-
{
234-
response = tmpResponse;
235-
}
217+
response = await m_messageInvoker.SendAsync(request, tokenSource.Token).ConfigureAwait(false);
236218

237219
traceInfo?.TraceRequestSendTime();
238220

src/Sdk/Common/Common/VssHttpRequestSettings.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,6 @@ public Boolean AllowAutoRedirect
110110
set;
111111
}
112112

113-
/// <summary>
114-
/// Gets or sets a value indicating whether or not HttpClientHandler should follow redirect on outgoing broker requests
115-
/// This is special since this also sends token in the request, where as default AllowAutoRedirect does not
116-
/// </summary>
117-
public Boolean AllowAutoRedirectForBroker
118-
{
119-
get;
120-
set;
121-
}
122-
123113
/// <summary>
124114
/// Gets or sets a value indicating whether or not compression should be used on outgoing requests.
125115
/// The default value is true.

0 commit comments

Comments
 (0)