perf(host): compile inbound API methods in parallel at startup
Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj
This commit is contained in:
@@ -403,10 +403,10 @@ try
|
||||
var apiRepo = scope.ServiceProvider.GetRequiredService<ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Repositories.IInboundApiRepository>();
|
||||
var executor = app.Services.GetRequiredService<ZB.MOM.WW.ScadaBridge.InboundAPI.InboundScriptExecutor>();
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user