mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-20 02:37:55 +08:00
Fix command host retry logic
--HG-- branch : dev
This commit is contained in:
@@ -42,18 +42,16 @@ namespace Orchard.Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int StartHost(TextReader input, TextWriter output) {
|
public int StartHost(TextReader input, TextWriter output) {
|
||||||
|
|
||||||
// This retry logic is not exactly clean, but a change in configuration
|
|
||||||
// sometimes need us to re-try initializing a host container.
|
|
||||||
Retry:
|
|
||||||
try {
|
try {
|
||||||
_hostContainer = CreateHostContainer();
|
_hostContainer = CreateHostContainer();
|
||||||
_tenants = new Dictionary<string, IStandaloneEnvironment>();
|
_tenants = new Dictionary<string, IStandaloneEnvironment>();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
catch (OrchardCommandHostRetryException e) {
|
catch (OrchardCommandHostRetryException e) {
|
||||||
output.WriteLine("{0} (Retrying...)", e.Message);
|
// Special "Retry" return code for our host
|
||||||
goto Retry;
|
output.WriteLine("{0}", e.Message);
|
||||||
|
output.WriteLine("(Retrying...)");
|
||||||
|
return 240;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
for (; e != null; e = e.InnerException) {
|
for (; e != null; e = e.InnerException) {
|
||||||
|
@@ -78,7 +78,10 @@ namespace Orchard {
|
|||||||
var orchardDirectory = GetOrchardDirectory(_arguments.WorkingDirectory);
|
var orchardDirectory = GetOrchardDirectory(_arguments.WorkingDirectory);
|
||||||
LogInfo("Orchard root directory: \"{0}\"", orchardDirectory.FullName);
|
LogInfo("Orchard root directory: \"{0}\"", orchardDirectory.FullName);
|
||||||
|
|
||||||
return CreateHostAndExecute(orchardDirectory);
|
int result = CreateHostAndExecute(orchardDirectory);
|
||||||
|
if (result == 240/*special return code for "Retry"*/)
|
||||||
|
result = CreateHostAndExecute(orchardDirectory);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int CreateHostAndExecute(DirectoryInfo orchardDirectory) {
|
private int CreateHostAndExecute(DirectoryInfo orchardDirectory) {
|
||||||
|
Reference in New Issue
Block a user