Skip to content

Make page load async when using endpoint routing #7938

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 4 commits into from
Mar 4, 2019

Conversation

pranavkm
Copy link
Contributor

@pranavkm pranavkm commented Feb 26, 2019

Fixes #8016

@pranavkm pranavkm requested review from JamesNK and rynowak February 26, 2019 02:42
@rynowak
Copy link
Member

rynowak commented Feb 26, 2019

This is D O P E

Copy link
Member

@JamesNK JamesNK left a comment

Choose a reason for hiding this comment

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

What problem is changing the type to be async solving? In some places it is moving GetResult from one place to another.

@mkArtak
Copy link
Contributor

mkArtak commented Feb 26, 2019

Can you please link the issue this addresses?

@Eilon Eilon added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Feb 26, 2019
@pranavkm pranavkm added the breaking-change This issue / pr will introduce a breaking change, when resolved / merged. label Feb 26, 2019
@pranavkm
Copy link
Contributor Author

@JamesNK filed an issue for this - #8016. But in essence we make a blocking call when loading the page, which performs async work. We end up getting reports of application deadlocks due to thread pool starvation. This change attempts to address it fairly cheaply with endpoint routing.

}
}

public virtual ValueTask<CompiledPageActionDescriptor> GetOrAddAsync(PageActionDescriptor actionDescriptor)
Copy link
Member

Choose a reason for hiding this comment

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

Is this really a good usage of ValueTask? I don't think ValueTask can be awaited multiple times. Also the usual pattern for this is to cache Task<T> instead of caching T

@rynowak
Copy link
Member

rynowak commented Mar 1, 2019

Does this really need the breaking change label? Is the breaking change that we're not calling an old API anymore?

@pranavkm pranavkm force-pushed the prkrishn/async-load branch 2 times, most recently from a34f5ee to eb9c04c Compare March 2, 2019 00:19
pranavkm added 3 commits March 2, 2019 07:52
* Use ActionDescriptorCollection.Version to invalidate PageLoader cache
* Add tests, changes per PR
@pranavkm pranavkm removed the breaking-change This issue / pr will introduce a breaking change, when resolved / merged. label Mar 2, 2019
@pranavkm pranavkm force-pushed the prkrishn/async-load branch from eb9c04c to 919eb51 Compare March 2, 2019 15:57
@pranavkm
Copy link
Contributor Author

pranavkm commented Mar 2, 2019

Does this really need the breaking change label? Is the breaking change that we're not calling an old API anymore?

Not any longer. I wasn't registering the IPageLoader in one of the iterations which could have been construed as breaking. All we have now is the ObsoleteAttribute on IPageLoader

@pranavkm
Copy link
Contributor Author

pranavkm commented Mar 2, 2019

🆙 📅

public abstract class PageLoader : IPageLoader
#pragma warning restore CS0618 // Type or member is obsolete
{
public abstract Task<CompiledPageActionDescriptor> LoadAsync(PageActionDescriptor actionDescriptor);
Copy link
Member

Choose a reason for hiding this comment

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

DOCS YO

Copy link
Member

@rynowak rynowak left a comment

Choose a reason for hiding this comment

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

:shipit:

@pranavkm pranavkm merged commit 39e5257 into master Mar 4, 2019
@pranavkm pranavkm deleted the prkrishn/async-load branch March 4, 2019 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants