Skip to content

Fix/hot reload shutdown - #8

Open
DBeardionaire wants to merge 2 commits into
davidwhitney:mainfrom
DBeardionaire:fix/hot-reload-shutdown
Open

DBeardionaire wants to merge 2 commits into
davidwhitney:mainfrom
DBeardionaire:fix/hot-reload-shutdown

Conversation

@DBeardionaire

Copy link
Copy Markdown

Connected HMR WebSockets can keep requests alive during application shutdown, delaying the host from stopping. I 1st saw this when using aspire rebuild/restart and then with dotnet run and Ctrl + C.

Registers the hot reload service with IHostApplicationLifetime.ApplicationStopping so shutdown aborts connected sockets and unsubscribes from build notifications. Guarded client registration so connections arriving during shutdown are also aborted, and reuse the cleanup during disposal.

Adds a component regression test that connects an HMR client, triggers application stopping, and verifies the service clears its connected clients.

@DBeardionaire

Copy link
Copy Markdown
Author

I also see a test failing locally in LargeGraphTests that I didn't include in case it should be handled separately or is just failing on my machine

JsxCore/test/JsxCore.Tests/Unit/PackageManagement/Native/LargeGraphTests.cs

[Theory]
[InlineData("eslint")]
[InlineData("webpack")]
[InlineData("jest")]
public async Task Resolve_LargeGraph_ProducesATreeWhereEveryDependencyResolves(string package)
{
    var placed = await new PackageResolver(Registry()).ResolveAsync([new PackageRequest(package, "")]);

    placed.Count.ShouldBeGreaterThan(50);
    PackageResolver.Validate(placed).ShouldBeEmpty();
}

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.

1 participant