Every page load initialises a connection to kubernetes, subscribing to containers, executables, endpoints and services. This data streams in asynchronously, concurrent with the page load. From the user's perspective, the UI takes a few beats to reach a steady state.
We should change this to a singleton so that clients receive all data with the initial connection, and F5 is instantaneous. This will also reduce memory when multiple clients are connected.
Note that we cannot change to a singleton just yet, as IResourceService works with mutable ResourceViewModel objects.
Before tacking this, we will make IResourceService work with immutable ResourceSnapshot values, and move the mutable view model state to the client, scoped to the current user session.
Currently, the
IResourceService
component is scoped to the user session:https://github.com/dotnet/aspire/blob/f7bd7c2d7f6821d2113e164070382420657c767f/src/Aspire.Hosting/Dcp/DcpHostService.cs#L65
Every page load initialises a connection to kubernetes, subscribing to containers, executables, endpoints and services. This data streams in asynchronously, concurrent with the page load. From the user's perspective, the UI takes a few beats to reach a steady state.
We should change this to a singleton so that clients receive all data with the initial connection, and F5 is instantaneous. This will also reduce memory when multiple clients are connected.
Note that we cannot change to a singleton just yet, as
IResourceService
works with mutableResourceViewModel
objects.Before tacking this, we will make
IResourceService
work with immutableResourceSnapshot
values, and move the mutable view model state to the client, scoped to the current user session.Scoped (before)
Singleton (after)