In ASP.NET Core 6 minimal API, I've been working with Azure App Configuration feature flags. I have set up the feature flag configuration so that the flags expire in 5 seconds.
builder.Configuration.AddAzureAppConfiguration(
options => options.UseFeatureFlags(opts => opts.CacheExpirationInterval = TimeSpan.FromSeconds(5)));
I also have added Azure App Configuration and Feature Management services
builder.Services.AddAzureAppConfiguration();
builder.Services.AddFeatureManagement();
And set up the usage
app.UseAzureAppConfiguration();
I tried out one of the feature flags if it is enabled with code below
bool isServiceEnabled = await _featureManager.IsEnabledAsync(FeatureFlags.IsServiceEnabled);
At first it does read the correct value from the App Configuration, then I tried toggling it and calling API after the cache expires, first call to the API still shows me the old value. It's only the second call to the API after expiration that does show the new value.
It seems like first API call still has the old value cached.
Have I missed something? Did I do something wrong while setting up the feature flags?