Page MenuHomePhabricator

D21808.id51982.diff
No OneTemporary

D21808.id51982.diff

diff --git a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
--- a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
+++ b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
@@ -506,28 +506,21 @@
protected function shouldLimitAllocatingPoolSize(
DrydockBlueprint $blueprint) {
- // TODO: If this mechanism sticks around, these values should be
- // configurable by the blueprint implementation.
-
// Limit on total number of active resources.
$total_limit = $this->getConcurrentResourceLimit($blueprint);
-
- // Always allow at least this many allocations to be in flight at once.
- $min_allowed = 1;
-
- // Allow this fraction of allocating resources as a fraction of active
- // resources.
- $growth_factor = 0.25;
+ if ($total_limit === null) {
+ return false;
+ }
$resource = new DrydockResource();
- $conn_r = $resource->establishConnection('r');
+ $conn = $resource->establishConnection('r');
$counts = queryfx_all(
- $conn_r,
- 'SELECT status, COUNT(*) N FROM %T
+ $conn,
+ 'SELECT status, COUNT(*) N FROM %R
WHERE blueprintPHID = %s AND status != %s
GROUP BY status',
- $resource->getTableName(),
+ $resource,
$blueprint->getPHID(),
DrydockResourceStatus::STATUS_DESTROYED);
$counts = ipull($counts, 'N', 'status');
@@ -539,29 +532,12 @@
// If we're at the limit on total active resources, limit additional
// allocations.
- if ($total_limit !== null) {
- $n_total = ($n_alloc + $n_active + $n_broken + $n_released);
- if ($n_total >= $total_limit) {
- return true;
- }
- }
-
- // If the number of in-flight allocations is fewer than the minimum number
- // of allowed allocations, don't impose a limit.
- if ($n_alloc < $min_allowed) {
- return false;
+ $n_total = ($n_alloc + $n_active + $n_broken + $n_released);
+ if ($n_total >= $total_limit) {
+ return true;
}
- $allowed_alloc = (int)ceil($n_active * $growth_factor);
-
- // If the number of in-flight allocation is fewer than the number of
- // allowed allocations according to the pool growth factor, don't impose
- // a limit.
- if ($n_alloc < $allowed_alloc) {
- return false;
- }
-
- return true;
+ return false;
}
}

File Metadata

Mime Type
text/plain
Expires
Jun 13 2024, 6:42 AM (4 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6285145
Default Alt Text
D21808.id51982.diff (2 KB)

Event Timeline