From 102f5b60ee5208566dcff9fbd4e1d9bc87e6d720 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 10 Jul 2026 03:49:53 -0400 Subject: [PATCH] perf(host): compile inbound API methods in parallel at startup Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj --- src/ZB.MOM.WW.ScadaBridge.Host/Program.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ZB.MOM.WW.ScadaBridge.Host/Program.cs b/src/ZB.MOM.WW.ScadaBridge.Host/Program.cs index d658e7fb..4ef81823 100644 --- a/src/ZB.MOM.WW.ScadaBridge.Host/Program.cs +++ b/src/ZB.MOM.WW.ScadaBridge.Host/Program.cs @@ -403,10 +403,10 @@ try var apiRepo = scope.ServiceProvider.GetRequiredService(); var executor = app.Services.GetRequiredService(); var methods = await apiRepo.GetAllApiMethodsAsync(); - foreach (var method in methods) - { - executor.CompileAndRegister(method); - } + // Parallel: CompileAndRegister is safe for concurrent callers (ConcurrentDictionary + // caches, no shared mutable compile state); serial Roslyn compiles stretch the + // failover-recovery window at hundreds of methods (arch-review PLAN-06 Task 7). + Parallel.ForEach(methods, method => executor.CompileAndRegister(method)); } await app.RunAsync();