Revert "Add retries to selfhost deployer (#13063)"

- per @Tratcher this change is not needed in 'master'

This reverts commit d19093ecbb.
This commit is contained in:
Doug Bunting 2019-09-20 16:48:14 -07:00
parent 339c720d86
commit 24fe524029
No known key found for this signature in database
GPG Key ID: EE41520987982C03
3 changed files with 18 additions and 29 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;

View File

@ -22,7 +22,6 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
private static readonly Regex NowListeningRegex = new Regex(@"^\s*Now listening on: (?<url>.*)$");
private const string ApplicationStartedMessage = "Application started. Press Ctrl+C to shut down.";
private const int RetryCount = 5;
public Process HostProcess { get; private set; }
public SelfHostDeployer(DeploymentParameters deploymentParameters, ILoggerFactory loggerFactory)
@ -56,33 +55,23 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
DotnetPublish();
}
var hintUrl = TestUriHelper.BuildTestUri(
DeploymentParameters.ServerType,
DeploymentParameters.Scheme,
DeploymentParameters.ApplicationBaseUriHint,
DeploymentParameters.StatusMessagesEnabled);
// Launch the host process.
for (var i = 0; i < RetryCount; i++)
{
var hintUrl = TestUriHelper.BuildTestUri(
DeploymentParameters.ServerType,
DeploymentParameters.Scheme,
DeploymentParameters.ApplicationBaseUriHint,
DeploymentParameters.StatusMessagesEnabled);
var (actualUrl, hostExitToken) = await StartSelfHostAsync(hintUrl);
var (actualUrl, hostExitToken) = await StartSelfHostAsync(hintUrl);
if (DeploymentParameters.ServerType == ServerType.HttpSys && hostExitToken.IsCancellationRequested)
{
// Retry HttpSys deployments due to port conflicts.
continue;
}
Logger.LogInformation("Application ready at URL: {appUrl}", actualUrl);
Logger.LogInformation("Application ready at URL: {appUrl}", actualUrl);
return new DeploymentResult(
LoggerFactory,
DeploymentParameters,
applicationBaseUri: actualUrl.ToString(),
contentRoot: DeploymentParameters.PublishApplicationBeforeDeployment ? DeploymentParameters.PublishedApplicationRootPath : DeploymentParameters.ApplicationPath,
hostShutdownToken: hostExitToken);
}
throw new Exception($"Failed to start Self hosted application after {RetryCount} retries.");
return new DeploymentResult(
LoggerFactory,
DeploymentParameters,
applicationBaseUri: actualUrl.ToString(),
contentRoot: DeploymentParameters.PublishApplicationBeforeDeployment ? DeploymentParameters.PublishedApplicationRootPath : DeploymentParameters.ApplicationPath,
hostShutdownToken: hostExitToken);
}
}
@ -176,6 +165,8 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
Logger.LogInformation("host process ID {pid} shut down", HostProcess.Id);
// If TrySetResult was called above, this will just silently fail to set the new state, which is what we want
started.TrySetException(new Exception($"Command exited unexpectedly with exit code: {HostProcess.ExitCode}"));
TriggerHostShutdown(hostExitTokenSource);
};
@ -187,6 +178,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
{
Logger.LogError("Error occurred while starting the process. Exception: {exception}", ex.ToString());
}
if (HostProcess.HasExited)
{
Logger.LogError("Host process {processName} {pid} exited with code {exitCode} or failed to start.", startInfo.FileName, HostProcess.Id, HostProcess.ExitCode);

View File

@ -1,3 +0,0 @@
@ECHO OFF
SET RepoRoot=%~dp0..\..
%RepoRoot%\build.cmd -projects %~dp0**\*.*proj %*