Changed distributed shell restart to only apply to the correct tenant.

This commit is contained in:
Daniel Stolt
2015-07-28 16:35:51 +01:00
parent f708362313
commit dedded7422

View File

@@ -24,12 +24,12 @@ namespace Orchard.MessageBus.Services {
} }
public void Activated() { public void Activated() {
_messageBus.Subscribe(Channel, (channel, message) => { _messageBus.Subscribe(Channel, (channel, tenantName) => {
// todo: this only handles changed tenants, we should consider handling started and stopped tenants // todo: this only handles changed tenants, we should consider handling started and stopped tenants
using (var scope = _workContextAccessor.CreateWorkContextScope()) { using (var scope = _workContextAccessor.CreateWorkContextScope()) {
var shellSettings = scope.Resolve<ShellSettings>(); var shellSettings = scope.Resolve<ShellSettings>();
if (shellSettings != null) { if (shellSettings != null && shellSettings.Name == tenantName) {
// todo: this doesn't work as the new tenants list is lost right after // todo: this doesn't work as the new tenants list is lost right after
var shellSettingsManagerEventHandler = scope.Resolve<IShellSettingsManagerEventHandler>(); var shellSettingsManagerEventHandler = scope.Resolve<IShellSettingsManagerEventHandler>();