Activate tenants in parallel

This commit is contained in:
Sebastien Ros
2013-11-26 10:33:21 -08:00
parent 5888caa3d3
commit 082b28204b

View File

@@ -2,6 +2,7 @@ using System;
using System.Linq;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Threading.Tasks;
using Orchard.Caching;
using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions;
@@ -129,15 +130,15 @@ namespace Orchard.Environment {
// load all tenants, and activate their shell
if (allSettings.Any()) {
foreach (var settings in allSettings) {
Parallel.ForEach(allSettings, settings => {
try {
var context = CreateShellContext(settings);
ActivateShell(context);
}
catch(Exception e) {
catch (Exception e) {
Logger.Error(e, "A tenant could not be started: " + settings.Name);
}
}
});
}
// no settings, run the Setup
else {