Beispiel #1
0
        protected internal void RefreshInstanceInfo()
        {
            InstanceInfo info = _appInfoManager.InstanceInfo;

            if (info == null)
            {
                return;
            }

            _appInfoManager.RefreshLeaseInfo();

            InstanceStatus status = InstanceStatus.UNKNOWN;

            if (HealthCheckHandler != null)
            {
                try
                {
                    status = HealthCheckHandler.GetStatus(info.Status);
                }
                catch (Exception e)
                {
                    _logger?.LogError(
                        "RefreshInstanceInfo HealthCheck handler exception: {0}, App: {1}, Instance: {2} marked DOWN",
                        e,
                        info.AppName,
                        info.InstanceId);
                    status = InstanceStatus.DOWN;
                }
            }

            if (status != InstanceStatus.UNKNOWN)
            {
                info.Status = status;
            }
        }
        protected internal void RefreshInstanceInfo()
        {
            var info = _appInfoManager.InstanceInfo;

            if (info == null)
            {
                return;
            }

            _appInfoManager.RefreshLeaseInfo();

            InstanceStatus?status = null;

            if (IsHealthCheckHandlerEnabled())
            {
                try
                {
                    status = HealthCheckHandler.GetStatus(info.Status);
                    _logger?.LogDebug("RefreshInstanceInfo called, returning {status}", status);
                }
                catch (Exception e)
                {
                    _logger?.LogError(
                        e,
                        "RefreshInstanceInfo HealthCheck handler. App: {Application}, Instance: {Instance} marked DOWN",
                        info.AppName,
                        info.InstanceId);
                    status = InstanceStatus.DOWN;
                }
            }

            if (status.HasValue)
            {
                _appInfoManager.InstanceStatus = status.Value;
            }
        }