This repository was archived by the owner on Dec 19, 2018. It is now read-only.
Default timeout for IHost.StopAsync. Create Host with DI.#1237
Merged
Conversation
muratg
reviewed
Oct 13, 2017
| services.AddSingleton(_appConfiguration); | ||
| services.AddSingleton<IApplicationLifetime, ApplicationLifetime>(); | ||
| services.AddSingleton<IHostLifetime, ProcessLifetime>(); | ||
| services.AddSingleton<IHost, Host>(); |
There was a problem hiding this comment.
Don't these need to be after AddOptions?
Member
Author
There was a problem hiding this comment.
It's not order sensitive.
halter73
approved these changes
Oct 16, 2017
| public Host(IServiceProvider services, IApplicationLifetime applicationLifetime, ILogger<Host> logger, | ||
| IHostLifetime hostLifetime, IOptions<HostOptions> options) | ||
| { | ||
| if (options == null) |
Member
There was a problem hiding this comment.
Nit: Might be worth guarding agains and NRE in StopAsync by ensuring options.Value isn't null. ConsoleLifetime does options?.Value ?? throw new ArgumentNullException(nameof(options)); which I think is reasonable enough.
| } | ||
| } | ||
|
|
||
| [Fact] |
Member
There was a problem hiding this comment.
Nit: Shorten the Task.Delay(TimeSpan.FromSeconds(8)) in HostStopAsyncCanBeCancelledEarly to be less than 5 seconds.
d6fc7d1 to
4f3fdae
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#1208 This ports the default shutdown timeout from WebHost to Host. It also introduces HostOptions for configuring the value, and changes Host to be instantiated via DI.
I recommend the https://github.com/aspnet/Hosting/pull/1237/files?w=1 view when reviewing Host.cs