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

Support concurrency in IFeatureManagerSnapshot #141

Merged

Conversation

jimmyca15
Copy link
Member

The current implementation of IFeatureManagerSnapshot is not thread safe. This PR enhances the implementation to support concurrency.

Addresses #136


return enabled;
return await evaluator.Value.ConfigureAwait(false);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to await the task here, just return it thus saving the async state machinery (allocations).

I'm not sure if the Lazy is needed. It's safer for race conditions in the sense of flag evaluations, but caching is a best effort solution which should be fast, so I would trade perf over possible "double evaluations".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gfoidl thanks that's a good improvement with the await removal.

I'm going to remove the double evaluation protection in this PR and think about that problem a bit more.

@jimmyca15 jimmyca15 force-pushed the user/jimmyca/snapshotConcurrency branch from b228b45 to 4465562 Compare September 4, 2021 00:19
@jimmyca15
Copy link
Member Author

Had to rebase to resolve a merge conflict.

@jimmyca15 jimmyca15 merged commit e366fd5 into microsoft:main Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants