mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-17 22:03:44 +02:00
Return all servers for a node as a paginated response
Avoids crashing the PHP process and avoids a bad runaway N+1 query issue that previously existed.
This commit is contained in:
@@ -270,22 +270,4 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
|
||||
->where('node_id', '=', $node)
|
||||
->paginate($limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns every server that exists for a given node.
|
||||
*
|
||||
* This is different from {@see loadAllServersForNode} because
|
||||
* it does not paginate the response.
|
||||
*
|
||||
* @param int $node
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function loadEveryServerForNode(int $node)
|
||||
{
|
||||
return $this->getBuilder()
|
||||
->with('nest')
|
||||
->where('node_id', '=', $node)
|
||||
->get();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user