Enforce per-node allocation limit when finding available nodes - #1358
Open
KroZen-Dev wants to merge 3 commits into
Open
Enforce per-node allocation limit when finding available nodes#1358KroZen-Dev wants to merge 3 commits into
KroZen-Dev wants to merge 3 commits into
Conversation
Ensure nodes that have reached their per-node allocation limit are excluded before attempting to assign a free allocation, preventing selection of nodes that cannot host new servers.
2 tasks
MrWeez
requested changes
Jul 28, 2026
MrWeez
requested changes
Jul 28, 2026
Comment on lines
580
to
584
| try { | ||
| $freeAllocations = $this->pterodactyl->getFreeAllocations($node); | ||
| } catch (\Exception $e) { | ||
| return true; | ||
| } |
Collaborator
There was a problem hiding this comment.
Because we wrapped $response inside getFreeAllocations() (see review comment for that function) you don't need to wrap call site here
- wrap getAllocations in try/catch inside getFreeAllocations and nodeHasReachedAllocationLimit - remove redundant try/catch from callers in ServerController and ServerCreationService - simplify nodeHasReachedAllocationLimit to read allocation_limit directly from node
MrWeez
approved these changes
Jul 29, 2026
Collaborator
|
Good work! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Enforce the per-node allocation limit when selecting an available node for
server provisioning. Previously,
findAvailableNode()only rejected nodesthat lacked resources or had no free allocations, and
findAvailableNodeWithAllocation()only checked resources — neither checkedwhether a node had already reached its per-node allocation limit. As a result,
nodes at their allocation limit could still be treated as available and only
fail later when trying to grab an allocation.
This adds an early guard in both methods: if
nodeHasReachedAllocationLimit($node, $node->allocation_limit)is true, thenode is rejected before any free-allocation lookup, making node selection more
accurate and avoiding wasted calls.
Type of Change
Testing
findAvailableNode()rejects a node once its per-node allocationlimit is reached.
findAvailableNodeWithAllocation()skips nodes at their allocationlimit and falls through to the next available node.
Checklist
developmentbranch