Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
YunchuWang committed Jan 11, 2025
1 parent ee295d0 commit 522d4b0
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions src/Extensions/Azure/DurableTaskSchedulerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static void UseDurableTaskScheduler(
TokenCredential credential,
Action<DurableTaskSchedulerOptions>? configure = null)
{
builder.Services.AddOptions<DurableTaskSchedulerOptions>(Options.DefaultName)
builder.Services.AddOptions<DurableTaskSchedulerOptions>(builder.Name)
.Configure(options =>
{
options.EndpointAddress = endpointAddress;
Expand Down Expand Up @@ -121,7 +121,7 @@ public static void UseDurableTaskScheduler(
{
var connectionOptions = DurableTaskSchedulerOptions.FromConnectionString(connectionString);

builder.Services.AddOptions<DurableTaskSchedulerOptions>(Options.DefaultName)
builder.Services.AddOptions<DurableTaskSchedulerOptions>(builder.Name)
.Configure(configure ?? (_ => { }))
.ValidateDataAnnotations()
.ValidateOnStart();
Expand All @@ -140,34 +140,16 @@ internal class ConfigureGrpcChannel(IOptionsMonitor<DurableTaskSchedulerOptions>
IConfigureNamedOptions<GrpcDurableTaskWorkerOptions>,
IConfigureNamedOptions<GrpcDurableTaskClientOptions>
{
/// <summary>
/// Configures worker options using the default options name.
/// </summary>
/// <param name="options">The worker options to configure.</param>
public void Configure(GrpcDurableTaskWorkerOptions options) => this.Configure(Options.DefaultName, options);

/// <summary>
/// Configures client options using the default options name.
/// </summary>
/// <param name="options">The client options to configure.</param>
public void Configure(GrpcDurableTaskClientOptions options) => this.Configure(Options.DefaultName, options);

/// <summary>
/// Configures named worker options by creating and assigning a gRPC channel.
/// </summary>
/// <param name="name">The name of the options instance being configured, or null for the default instance.</param>
/// <param name="options">The worker options to configure.</param>
public void Configure(string? name, GrpcDurableTaskWorkerOptions options)
{
DurableTaskSchedulerOptions source = schedulerOptions.Get(name ?? Options.DefaultName);
options.Channel = source.CreateChannel();
}

/// <summary>
/// Configures named client options by creating and assigning a gRPC channel.
/// </summary>
/// <param name="name">The name of the options instance being configured, or null for the default instance.</param>
/// <param name="options">The client options to configure.</param>
public void Configure(string? name, GrpcDurableTaskClientOptions options)
{
DurableTaskSchedulerOptions source = schedulerOptions.Get(name ?? Options.DefaultName);
Expand Down

0 comments on commit 522d4b0

Please sign in to comment.