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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user