hosting: fixed running ActivePassive instance

This commit is contained in:
Alexey Bannov 2022-09-15 23:56:55 +03:00
parent ab5de603c1
commit c91711dbeb
2 changed files with 7 additions and 1 deletions

View File

@ -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<T> : IRegisterInstanceDao<T> where T : IHostedS
if (inst == null)
{
await _instanceRegistrationContext.AddAsync(obj);
}
else
{
_instanceRegistrationContext.Entry(inst).CurrentValues.SetValues(obj);
}
bool saveFailed;

View File

@ -60,7 +60,7 @@ public class RegisterInstanceManager<T> : IRegisterInstanceManager<T> where T :
{
var firstAliceInstance = GetFirstAliveInstance(instances);
if (firstAliceInstance != null && firstAliceInstance.InstanceRegistrationId == instance.InstanceRegistrationId)
if (firstAliceInstance == null || firstAliceInstance.InstanceRegistrationId == instance.InstanceRegistrationId)
{
instance.IsActive = true;
}