fix(deployment): read every external system's methods in one query for the artifact snapshot (review 2026-10-21 04/P7)
This commit is contained in:
@@ -301,7 +301,8 @@ public class ArtifactDeploymentService
|
||||
/// <remarks>
|
||||
/// The per-site artifact build path previously re-issued
|
||||
/// every one of these queries per site (≈ N + M·N round trips for N sites
|
||||
/// and M external systems). Hoisting them here drops that to a single fetch.
|
||||
/// and M external systems). Hoisting them here drops that to a single fetch, and the
|
||||
/// methods of every external system are read in one query rather than one per system.
|
||||
///
|
||||
/// Notification lists and SMTP configurations are NOT
|
||||
/// fetched here. Notification delivery is central-only, so they are never
|
||||
@@ -313,6 +314,10 @@ public class ArtifactDeploymentService
|
||||
var externalSystems = await _externalSystemRepo.GetAllExternalSystemsAsync(cancellationToken);
|
||||
var dbConnections = await _externalSystemRepo.GetAllDatabaseConnectionsAsync(cancellationToken);
|
||||
|
||||
// Every system's methods in ONE query, grouped here — not one query per system.
|
||||
var methodsBySystem = (await _deploymentRepo.GetAllExternalSystemMethodsAsync(cancellationToken))
|
||||
.ToLookup(m => m.ExternalSystemDefinitionId);
|
||||
|
||||
// Map shared scripts
|
||||
var scriptArtifacts = sharedScripts.Select(s =>
|
||||
new SharedScriptArtifact(s.Name, s.Code, s.ParameterDefinitions, s.ReturnDefinition)).ToList();
|
||||
@@ -321,7 +326,7 @@ public class ArtifactDeploymentService
|
||||
var externalSystemArtifacts = new List<ExternalSystemArtifact>();
|
||||
foreach (var es in externalSystems)
|
||||
{
|
||||
var methods = await _externalSystemRepo.GetMethodsByExternalSystemIdAsync(es.Id, cancellationToken);
|
||||
var methods = methodsBySystem[es.Id].ToList();
|
||||
// The property NAMES emitted here are part of a contract:
|
||||
// ArtifactRevisionHashService.CanonicalizeMethodDefinitions re-orders this array by
|
||||
// each element's "Name" property (case-insensitively) so repository row order cannot
|
||||
|
||||
Reference in New Issue
Block a user