about summary refs log tree commit diff
path: root/MatrixUtils.Web/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixUtils.Web/Program.cs')
-rw-r--r--MatrixUtils.Web/Program.cs17
1 files changed, 16 insertions, 1 deletions
diff --git a/MatrixUtils.Web/Program.cs b/MatrixUtils.Web/Program.cs

index 1b8960c..8bc2c8f 100644 --- a/MatrixUtils.Web/Program.cs +++ b/MatrixUtils.Web/Program.cs
@@ -8,6 +8,8 @@ using MatrixUtils.Web; using MatrixUtils.Web.Classes; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +using SpawnDev.BlazorJS; +using SpawnDev.BlazorJS.WebWorkers; var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add<App>("#app"); @@ -16,6 +18,18 @@ builder.RootComponents.Add<HeadOutlet>("head::after"); // builder.Logging.SetMinimumLevel(LogLevel.Trace); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); +builder.Services.AddBlazorJSRuntime(); +builder.Services.AddWebWorkerService(webWorkerService => +{ + // Optionally configure the WebWorkerService service before it is used + // Default WebWorkerService.TaskPool settings: PoolSize = 0, MaxPoolSize = 1, AutoGrow = true + // Below sets TaskPool max size to 2. By default the TaskPool size will grow as needed up to the max pool size. + // Setting max pool size to -1 will set it to the value of navigator.hardwareConcurrency + webWorkerService.TaskPool.MaxPoolSize = 2; + // Below is telling the WebWorkerService TaskPool to set the initial size to 2 if running in a Window scope and 0 otherwise + // This starts up 2 WebWorkers to handle TaskPool tasks as needed + webWorkerService.TaskPool.PoolSize = webWorkerService.GlobalScope == GlobalScope.Window ? 2 : 0; +}); try { builder.Configuration.AddJsonStream(await new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }.GetStreamAsync("/appsettings.json")); @@ -65,4 +79,5 @@ builder.Services.AddScoped<TieredStorageService>(x => builder.Services.AddRoryLibMatrixServices(); builder.Services.AddScoped<RMUStorageWrapper>(); -await builder.Build().RunAsync(); \ No newline at end of file +// await builder.Build().RunAsync(); +await builder.Build().BlazorJSRunAsync(); \ No newline at end of file