From c91711dbebd1bc72754e9a5cbb6b2635b12f07ef Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Thu, 15 Sep 2022 23:56:55 +0300 Subject: [PATCH] hosting: fixed running ActivePassive instance --- common/ASC.Core.Common/Hosting/RegisterInstanceDao.cs | 6 ++++++ common/ASC.Core.Common/Hosting/RegisterInstanceManager.cs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common/ASC.Core.Common/Hosting/RegisterInstanceDao.cs b/common/ASC.Core.Common/Hosting/RegisterInstanceDao.cs index 27d6b704fc..3c55805105 100644 --- a/common/ASC.Core.Common/Hosting/RegisterInstanceDao.cs +++ b/common/ASC.Core.Common/Hosting/RegisterInstanceDao.cs @@ -24,6 +24,8 @@ // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode +using ASC.Notify; + namespace ASC.Core.Common.Hosting; [Scope] @@ -48,6 +50,10 @@ public class RegisterInstanceDao : IRegisterInstanceDao where T : IHostedS if (inst == null) { await _instanceRegistrationContext.AddAsync(obj); + } + else + { + _instanceRegistrationContext.Entry(inst).CurrentValues.SetValues(obj); } bool saveFailed; diff --git a/common/ASC.Core.Common/Hosting/RegisterInstanceManager.cs b/common/ASC.Core.Common/Hosting/RegisterInstanceManager.cs index 0582776b24..7d45b48f7b 100644 --- a/common/ASC.Core.Common/Hosting/RegisterInstanceManager.cs +++ b/common/ASC.Core.Common/Hosting/RegisterInstanceManager.cs @@ -60,7 +60,7 @@ public class RegisterInstanceManager : IRegisterInstanceManager where T : { var firstAliceInstance = GetFirstAliveInstance(instances); - if (firstAliceInstance != null && firstAliceInstance.InstanceRegistrationId == instance.InstanceRegistrationId) + if (firstAliceInstance == null || firstAliceInstance.InstanceRegistrationId == instance.InstanceRegistrationId) { instance.IsActive = true; }