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

offers to start and stop IHostedService concurrently #84048

Merged
merged 3 commits into from
Apr 11, 2023

Conversation

pedrobsaila
Copy link
Contributor

Fixes #68036

I resumed the work of @jerryk414 on #75894 PR, so shout out to him for most of the work here. I addressed the remaining remarks on that PR.

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Mar 28, 2023
@ghost
Copy link

ghost commented Mar 28, 2023

Tagging subscribers to this area: @dotnet/area-extensions-hosting
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #68036

I resumed the work of @jerryk414 on #75894 PR, so shout out to him for most of the work here. I addressed the remaining remarks on that PR.

Author: pedrobsaila
Assignees: -
Labels:

new-api-needs-documentation, area-Extensions-Hosting

Milestone: -

Copy link
Contributor

@buyaa-n buyaa-n left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @pedrobsaila and @jerryk414!

@ericstj
Copy link
Member

ericstj commented Apr 21, 2023

I just happened upon this PR and was discussing with @buyaa-n and @stephentoub. Because we are still running Select over a set of async methods StartAsync|StopAsync the synchronous portion of these methods will still run sequentially on the thread calling Task.WhenAll in order to obtain Tasks to then wait on. If you wanted the synchronous portion of these methods to instead run on a background thread (and concurrently) then you'd want to wrap the call of these async methods in Task.Run.

It's unclear to me if the goal of this feature was to parallelize all of the work done in StartAsync|StopAsync or only the asynchronous portion of those methods. As of now, it only does the latter - and as @buyaa-n pointed out to me, asserts that the synchronous portion still runs in order.

@pedrobsaila @jerryk414 @eerhardt -- what do you think?

@pedrobsaila
Copy link
Contributor Author

pedrobsaila commented Apr 21, 2023

It's unclear to me if the goal of this feature was to parallelize all of the work done in StartAsync|StopAsync or only the asynchronous portion of those methods

I think the goal of this issue was to parallelize all of the work done in StartAsync|StopAsync

the synchronous portion of these methods will still run sequentially on the thread calling Task.WhenAll in order to obtain Tasks to then wait on

You are right, it is sequential. I'll fix it

@pedrobsaila
Copy link
Contributor Author

please check the PR #85191 fixing the issue.
Thanks @ericstj for spotting this anomaly

@ghost ghost locked as resolved and limited conversation to collaborators May 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Extensions-Hosting community-contribution Indicates that the PR has been added by a community member new-api-needs-documentation
Projects
None yet
4 participants