Comments (4)
Looks like this is by design :(. Not perfect imo.
Here is the code
public async Task<bool> IsEnabledAsync<TContext>(string feature, TContext context)
{
//
// First, check local cache
if (_flagCache.ContainsKey(feature))
{
return _flagCache[feature];
}
bool enabled = await _featureManager.IsEnabledAsync(feature, context).ConfigureAwait(false);
_flagCache[feature] = enabled;
return enabled;
}
from featuremanagement-dotnet.
The IFeatureManagerSnapshot is purposefully naïve when it comes to feature contexts. We would need a way to check for equality between contexts to be able to do anything further, and this would've required every context to implement an interface that we provide. This is not always possible so we decided not to impose this limitation. Our thoughts were that in general, if IFeatureManagerSnapshot would be useful in combination with feature contexts, then the lifetime of the feature manager snapshot would be in line with the lifetime of the feature context.
from featuremanagement-dotnet.
Another option we have is to allow Object.Equals to play the role of establishing context equality. This may solve the problem.
I do want to call out another factor that was considered. Caching an object passed in while evaluating the feature may have unintended consequences since callers might not necessarily be expecting the lifetime of the object to now be tied to the snapshot. It's something we'd want to consider if we did take the approach I just mentioned.
from featuremanagement-dotnet.
Thanks @jimmyca15, I guess that is fair enough. It would be great so see a bit more sophistication in how the manager operates, but I suppose I can live with it the way it is now.
I did experiment with Object.Equals
as I was formulating the linked PR, but it could be costly and since the contexts are not so strictly defined, it could lead to the equality comparisons being open to interpretation by engineers. I proposed a simple solution which just requires contexts to have IDs so that they can be easily compared with no ambiguity to what is actually being compared. Not feeling too strongly about this change, but I'm sure it is going to prove useful to some. I will close the PR as I plan to close this issue as well.
from featuremanagement-dotnet.
Related Issues (20)
- Infinite hang on configurationBuilder.Build() HOT 4
- CustomFilter breaks when upgrading to 2.6.0 with null reference exception HOT 5
- IgnoreMissingFeatureFilters should not be false by default HOT 5
- Authentication failed because the remote party has closed the transport stream HOT 2
- Using the CacheExpirationInterval option does not work on a console app HOT 4
- Feature Request: AddEndpointFilter for Minimal API's HOT 3
- Potential bug: Propagating App Service environment variables through IFeatureManager HOT 4
- is SDK cache persisted? HOT 2
- Feature flag with multiple custom filters HOT 5
- Feature Manager DI Scoping HOT 20
- Log level for missing feature declarations. HOT 2
- Adding version of public interface with generic parameters HOT 4
- Update docs with latest recommendations for defining and consuming feature flags HOT 3
- ch_n
- C
- ccc
- Targeting should support claims on top of existing user id & group targeting
- Performance over head for feature management filter HOT 1
- Change the feature flag name reference to const string HOT 3
- ValueTask returns HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from featuremanagement-dotnet.