Skip to content

Pre-Aggregate API Version Models #301

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

Merged
merged 1 commit into from
Jun 6, 2018

Conversation

commonsensesoftware
Copy link
Collaborator

@commonsensesoftware commonsensesoftware commented May 22, 2018

Refactor API version model aggregation to be pre-computed and supplants the need to modify action property bags at runtime. Fixes #306.


if ( model != null )
{
action.SetProperty( model.Aggregate( collatedModel ) );

Choose a reason for hiding this comment

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

Is this guaranteed to be thread safe? I can see that Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor the Properties "property" is backed by a simple Dictionary but I'm unclear of the flow here and if there is a case where there can be multiple threads accessing this (which is the problem you are trying to solve with this PR)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To my knowledge - yes. All IActionDescriptorProvider instances run at startup and complete their work before taking requests. Mutating this state in the request pipeline is not guaranteed to be write-safe, which is the issue being observed and remedied.

@commonsensesoftware commonsensesoftware merged commit 16b2ebe into master Jun 6, 2018
@commonsensesoftware commonsensesoftware deleted the dev/chrimart/pre-aggregate-model branch October 24, 2018 03:24
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.

2 participants