Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming configuration - updates are not propagated #934

Open
tomhreb opened this issue Aug 22, 2022 · 0 comments
Open

Streaming configuration - updates are not propagated #934

tomhreb opened this issue Aug 22, 2022 · 0 comments
Labels
kind/bug Something isn't working

Comments

@tomhreb
Copy link

tomhreb commented Aug 22, 2022

Expected Behavior

Using IOptionsMonitor I can receive updates from dapr configuration store.

Actual Behavior

I am not receiving updates from the configuration store.

Steps to Reproduce the Problem

This can be reproduced using minimal api app

Project file

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.8" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\src\Dapr.Extensions.Configuration\Dapr.Extensions.Configuration.csproj" />
  </ItemGroup>

</Project>

Program.cs

using Dapr.Client;
using Dapr.Extensions.Configuration;
using Microsoft.Extensions.Options;

var client = new DaprClientBuilder().Build();
var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
var configuration = builder.Configuration;

configuration.AddDaprConfigurationStore("redisConfig", new List<string> { "version" }, client, TimeSpan.FromSeconds(20));
configuration.AddStreamingDaprConfigurationStore("redisConfig", new List<string> { "version" }, client, TimeSpan.FromSeconds(20));

services.Configure<MyOptions>(builder.Configuration);
var app = builder.Build();

app.MapGet("/", context =>
{
    var config = context.RequestServices.GetRequiredService<IOptionsMonitor<MyOptions>>();

    return context.Response.WriteAsJsonAsync(config.CurrentValue.Version);
});

app.Run();

class MyOptions
{
    public string Version { get; set; }
}

By periodically quering this endpoint while updating the key in redis, the response shculd report updated value, which is not happening and the first value is reported.

EDIT: I've found the root cause and created #935

@tomhreb tomhreb added the kind/bug Something isn't working label Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant