mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 01:57: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) {
|
||||
|
||||
// This retry logic is not exactly clean, but a change in configuration
|
||||
// sometimes need us to re-try initializing a host container.
|
||||
Retry:
|
||||
try {
|
||||
_hostContainer = CreateHostContainer();
|
||||
_tenants = new Dictionary<string, IStandaloneEnvironment>();
|
||||
return 0;
|
||||
}
|
||||
catch (OrchardCommandHostRetryException e) {
|
||||
output.WriteLine("{0} (Retrying...)", e.Message);
|
||||
goto Retry;
|
||||
// Special "Retry" return code for our host
|
||||
output.WriteLine("{0}", e.Message);
|
||||
output.WriteLine("(Retrying...)");
|
||||
return 240;
|
||||
}
|
||||
catch (Exception e) {
|
||||
for (; e != null; e = e.InnerException) {
|
||||
|
@@ -78,7 +78,10 @@ namespace Orchard {
|
||||
var orchardDirectory = GetOrchardDirectory(_arguments.WorkingDirectory);
|
||||
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) {
|
||||
|
Reference in New Issue
Block a user