Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,9 @@ public void Set(string key, string? value)

LogSet(GetType().Name, key, value);

if (ConfigurationRoot != null)
{
ConfigurationRoot[key] = value;
}
#pragma warning disable S1121 // Assignments should not be made from within sub-expressions
ConfigurationRoot?[key] = value;
#pragma warning restore S1121 // Assignments should not be made from within sub-expressions
}

public void Dispose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static TypeAccessor MakeGenericTypeAccessor(Type connectionType)

public ConnectorShim<TOptions> Get(string serviceBindingName)
{
object instance = InstanceAccessor.InvokeMethodOverload(nameof(ConnectorFactory<TOptions, object>.Get), true, [typeof(string)], serviceBindingName)!;
object instance = InstanceAccessor.InvokeMethodOverload(nameof(ConnectorFactory<,>.Get), true, [typeof(string)], serviceBindingName)!;

return new ConnectorShim<TOptions>(_connectionType, instance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private static InstanceAccessor CreateAccessor(Type connectionType, object insta

public object GetConnection()
{
return InstanceAccessor.InvokeMethod(nameof(Connector<TOptions, object>.GetConnection), true)!;
return InstanceAccessor.InvokeMethod(nameof(Connector<,>.GetConnection), true)!;
}

public void Dispose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static class ConfigurationServiceCollectionExtensions
/// Build your list of service instances under the configuration prefix discovery:services.
/// <example>
/// Example configuration in appsettings.json:
/// <![CDATA[
/// <code><![CDATA[
/// {
/// "discovery": {
/// "services": [
Expand All @@ -36,7 +36,7 @@ public static class ConfigurationServiceCollectionExtensions
/// ]
/// }
/// }
/// ]]>
/// ]]></code>
/// </example>
/// </remarks>
/// <param name="services">
Expand Down
7 changes: 6 additions & 1 deletion src/Discovery/src/Eureka/AppInfo/ApplicationInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed class ApplicationInfo
private readonly ConcurrentDictionary<string, InstanceInfo> _instanceMap = new();

public string Name { get; }
public IReadOnlyList<InstanceInfo> Instances => new List<InstanceInfo>(_instanceMap.Values);
public IReadOnlyList<InstanceInfo> Instances => GetInstancesSnapshot();

internal ApplicationInfo(string name)
: this(name, Array.Empty<InstanceInfo>())
Expand All @@ -38,6 +38,11 @@ internal ApplicationInfo(string name, ICollection<InstanceInfo> instances)
}
}

private List<InstanceInfo> GetInstancesSnapshot()
{
return [.. _instanceMap.Values];
}

internal InstanceInfo? GetInstance(string instanceId)
{
ArgumentException.ThrowIfNullOrWhiteSpace(instanceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ namespace Steeltoe.Management.Endpoint.Actuators.Health.Availability;

/// <summary>
/// "Liveness" state of the application.
/// <para />
/// <para>
/// An application is considered live when it's running with a correct internal state. "Liveness" failure means that the internal state of the
/// application is broken, and we cannot recover from it. As a result, the platform should restart the application.
/// </para>
/// </summary>
public sealed class LivenessState : AvailabilityState
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ namespace Steeltoe.Management.Endpoint.Actuators.Health.Availability;

/// <summary>
/// The Readiness state of the application.
/// <para />
/// <para>
/// An application is considered ready when it's <see cref="LivenessState.Correct" /> and willing to accept traffic. "Readiness" failure means that the
/// application is not able to accept traffic and that the infrastructure should not route requests to it.
/// </para>
/// </summary>
public sealed class ReadinessState : AvailabilityState
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private static IEnumerable<AspNetEndpoint> FromActuatorEndpoint(RouteEndpoint en
if (endpointOptions != null)
{
string displayName = endpoint.DisplayName ?? string.Empty;
MethodInfo handlerMethod = typeof(EndpointMiddleware<,>).GetMethod(nameof(EndpointMiddleware<object, object>.InvokeAsync))!;
MethodInfo handlerMethod = typeof(EndpointMiddleware<,>).GetMethod(nameof(EndpointMiddleware<,>.InvokeAsync))!;
var metadataProvider = endpoint.Metadata.GetMetadata<ActuatorMetadataProvider>()!;

foreach (string httpMethod in endpointOptions.GetSafeAllowedVerbs())
Expand Down