mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-09 11:21:04 +08:00
Activate tenants in parallel
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Orchard.Caching;
|
using Orchard.Caching;
|
||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
@@ -129,15 +130,15 @@ namespace Orchard.Environment {
|
|||||||
|
|
||||||
// load all tenants, and activate their shell
|
// load all tenants, and activate their shell
|
||||||
if (allSettings.Any()) {
|
if (allSettings.Any()) {
|
||||||
foreach (var settings in allSettings) {
|
Parallel.ForEach(allSettings, settings => {
|
||||||
try {
|
try {
|
||||||
var context = CreateShellContext(settings);
|
var context = CreateShellContext(settings);
|
||||||
ActivateShell(context);
|
ActivateShell(context);
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch (Exception e) {
|
||||||
Logger.Error(e, "A tenant could not be started: " + settings.Name);
|
Logger.Error(e, "A tenant could not be started: " + settings.Name);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
// no settings, run the Setup
|
// no settings, run the Setup
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user