mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Added configurable RecipeExecutionTimeout properties.
* Added RecipeExecutionTimeout to SetupController. * Added RecipeExecutionTimeout to ExecuteRecipeAction. * Added property-injection registration source to ShellContainerFactory so that controllers can have their public properties be configured.
This commit is contained in:
@@ -106,5 +106,19 @@
|
|||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
|
|
||||||
|
<Component Type="Orchard.Setup.Controllers.SetupController">
|
||||||
|
<Properties>
|
||||||
|
<!-- Sets the request timeout to a configurable amount of seconds to give enough time to execute setup recipes. -->
|
||||||
|
<Property Name="RecipeExecutionTimeout" Value="600"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
|
||||||
|
<Component Type="Orchard.ImportExport.Providers.ImportActions.ExecuteRecipeAction">
|
||||||
|
<Properties>
|
||||||
|
<!-- Sets the request timeout to a configurable amount of seconds to give enough time to execute imported recipes. -->
|
||||||
|
<Property Name="RecipeExecutionTimeout" Value="600"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
|
||||||
</Components>
|
</Components>
|
||||||
</HostComponents>
|
</HostComponents>
|
||||||
|
@@ -51,13 +51,16 @@ namespace Orchard.ImportExport.Providers.ImportActions {
|
|||||||
_sweepGenerator = sweepGenerator;
|
_sweepGenerator = sweepGenerator;
|
||||||
_recipeStepQueue = recipeStepQueue;
|
_recipeStepQueue = recipeStepQueue;
|
||||||
_recipeStepResultRepository = recipeStepResultRepository;
|
_recipeStepResultRepository = recipeStepResultRepository;
|
||||||
}
|
|
||||||
|
RecipeExecutionTimeout = 600;
|
||||||
|
}
|
||||||
|
|
||||||
public override string Name { get { return "ExecuteRecipe"; } }
|
public override string Name { get { return "ExecuteRecipe"; } }
|
||||||
|
|
||||||
public XDocument RecipeDocument { get; set; }
|
public XDocument RecipeDocument { get; set; }
|
||||||
public bool ResetSite { get; set; }
|
public bool ResetSite { get; set; }
|
||||||
public string SuperUserPassword { get; set; }
|
public string SuperUserPassword { get; set; }
|
||||||
|
public int RecipeExecutionTimeout { get; set; }
|
||||||
|
|
||||||
public override dynamic BuildEditor(dynamic shapeFactory) {
|
public override dynamic BuildEditor(dynamic shapeFactory) {
|
||||||
return UpdateEditor(shapeFactory, null);
|
return UpdateEditor(shapeFactory, null);
|
||||||
@@ -149,8 +152,8 @@ namespace Orchard.ImportExport.Providers.ImportActions {
|
|||||||
// Give each execution step a chance to augment the recipe step before it will be scheduled.
|
// Give each execution step a chance to augment the recipe step before it will be scheduled.
|
||||||
PrepareRecipe(recipeDocument);
|
PrepareRecipe(recipeDocument);
|
||||||
|
|
||||||
// Sets the request timeout to 10 minutes to give enough time to execute custom recipes.
|
// Sets the request timeout to a configurable amount of seconds to give enough time to execute custom recipes.
|
||||||
_orchardServices.WorkContext.HttpContext.Server.ScriptTimeout = 600;
|
_orchardServices.WorkContext.HttpContext.Server.ScriptTimeout = RecipeExecutionTimeout;
|
||||||
|
|
||||||
// Suspend background task execution.
|
// Suspend background task execution.
|
||||||
_sweepGenerator.Terminate();
|
_sweepGenerator.Terminate();
|
||||||
|
@@ -33,10 +33,12 @@ namespace Orchard.Setup.Controllers {
|
|||||||
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
Logger = NullLogger.Instance;
|
Logger = NullLogger.Instance;
|
||||||
|
RecipeExecutionTimeout = 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
public ILogger Logger { get; set; }
|
public ILogger Logger { get; set; }
|
||||||
|
public int RecipeExecutionTimeout { get; set; }
|
||||||
|
|
||||||
private ActionResult IndexViewResult(SetupViewModel model) {
|
private ActionResult IndexViewResult(SetupViewModel model) {
|
||||||
return View(model);
|
return View(model);
|
||||||
@@ -70,8 +72,8 @@ namespace Orchard.Setup.Controllers {
|
|||||||
|
|
||||||
[HttpPost, ActionName("Index")]
|
[HttpPost, ActionName("Index")]
|
||||||
public ActionResult IndexPOST(SetupViewModel model) {
|
public ActionResult IndexPOST(SetupViewModel model) {
|
||||||
// Sets the setup request timeout to 10 minutes to give enough time to execute custom recipes.
|
// Sets the setup request timeout to a configurable amount of seconds to give enough time to execute custom recipes.
|
||||||
HttpContext.Server.ScriptTimeout = 600;
|
HttpContext.Server.ScriptTimeout = RecipeExecutionTimeout;
|
||||||
|
|
||||||
var recipes = _setupService.Recipes().ToList();
|
var recipes = _setupService.Recipes().ToList();
|
||||||
|
|
||||||
|
@@ -135,6 +135,10 @@ namespace Orchard.Environment.ShellBuilders {
|
|||||||
if (File.Exists(optionalShellConfig))
|
if (File.Exists(optionalShellConfig))
|
||||||
builder.RegisterModule(new ConfigurationSettingsReader(ConfigurationSettingsReaderConstants.DefaultSectionName, optionalShellConfig));
|
builder.RegisterModule(new ConfigurationSettingsReader(ConfigurationSettingsReaderConstants.DefaultSectionName, optionalShellConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var optionalComponentsConfig = HostingEnvironment.MapPath("~/Config/HostComponents.config");
|
||||||
|
if (File.Exists(optionalComponentsConfig))
|
||||||
|
builder.RegisterModule(new HostComponentsConfigModule(optionalComponentsConfig));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user