fix(external-system-gateway): resolve ExternalSystemGateway-011 — name-keyed repository lookups replace fetch-all-then-filter on the call hot path

This commit is contained in:
Joseph Doherty
2026-05-17 00:02:45 -04:00
parent 1e2e7d2e7c
commit a55502254e
10 changed files with 448 additions and 131 deletions

View File

@@ -170,8 +170,10 @@ public class DatabaseGateway : IDatabaseGateway
string connectionName,
CancellationToken cancellationToken)
{
var connections = await _repository.GetAllDatabaseConnectionsAsync(cancellationToken);
return connections.FirstOrDefault(c =>
c.Name.Equals(connectionName, StringComparison.OrdinalIgnoreCase));
// ExternalSystemGateway-011: name-keyed repository lookup instead of
// fetch-all-then-filter — connection definitions are resolved on every
// cached write / connection request, so the repository performs an indexed
// query rather than loading every connection into memory.
return await _repository.GetDatabaseConnectionByNameAsync(connectionName, cancellationToken);
}
}