Skip to content

Commit

Permalink
Change Resolver.ResolveAsync to virtual (#1523)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Dec 15, 2021
1 parent d5626ab commit 520c574
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
5 changes: 4 additions & 1 deletion src/Grpc.Net.Client/Balancer/Resolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ private async Task ResolveNowAsync(CancellationToken cancellationToken)
/// </summary>
/// <param name="cancellationToken">A cancellation token.</param>
/// <returns>A task.</returns>
protected abstract Task ResolveAsync(CancellationToken cancellationToken);
protected virtual Task ResolveAsync(CancellationToken cancellationToken)
{
return Task.CompletedTask;
}

/// <summary>
/// Releases the unmanaged resources used by the <see cref="LoadBalancer"/> and optionally releases
Expand Down
6 changes: 0 additions & 6 deletions src/Grpc.Net.Client/Balancer/StaticResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ protected override void OnStarted()
// Send addresses to listener once. They will never change.
Listener(ResolverResult.ForResult(_addresses, serviceConfig: null, serviceConfigStatus: null));
}

/// <inheritdoc />
protected override Task ResolveAsync(CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
}

/// <summary>
Expand Down
5 changes: 0 additions & 5 deletions test/Grpc.Net.Client.Tests/GrpcChannelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -836,11 +836,6 @@ public ChannelTestResolver(ResolverOptions options) : base(options.LoggerFactory
}

public ResolverOptions Options { get; }

protected override Task ResolveAsync(CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
}
#endif

Expand Down

0 comments on commit 520c574

Please sign in to comment.