perf(server): optimize destinationsByServer query
Replace in-memory filtering with database-level query in Server::destinationsByServer(). Previously loaded all team servers into memory before filtering by ID. Now uses findOrFail() to query directly at the database level.
This commit is contained in:
parent
f6a59fa2dc
commit
a38717810c
1 changed files with 1 additions and 1 deletions
|
|
@ -271,7 +271,7 @@ public static function isUsable()
|
||||||
|
|
||||||
public static function destinationsByServer(string $server_id)
|
public static function destinationsByServer(string $server_id)
|
||||||
{
|
{
|
||||||
$server = Server::ownedByCurrentTeam()->get()->where('id', $server_id)->firstOrFail();
|
$server = Server::ownedByCurrentTeam()->findOrFail($server_id);
|
||||||
$standaloneDocker = collect($server->standaloneDockers->all());
|
$standaloneDocker = collect($server->standaloneDockers->all());
|
||||||
$swarmDocker = collect($server->swarmDockers->all());
|
$swarmDocker = collect($server->swarmDockers->all());
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue