diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index d4d5fc64cf..62dc0b7deb 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -550,7 +550,9 @@ App::get('/v1/functions/specifications') } // Only add specs that are within the limits set by environment variables - if ($spec['cpus'] <= System::getEnv('_APP_FUNCTIONS_CPUS', 1) && $spec['memory'] <= System::getEnv('_APP_FUNCTIONS_MEMORY', 512)) { + if ( + ($spec['cpus'] <= System::getEnv('_APP_FUNCTIONS_CPUS', 1) || System::getEnv('_APP_FUNCTIONS_CPUS', 1) === 0) && + ($spec['memory'] <= System::getEnv('_APP_FUNCTIONS_MEMORY', 512)) || System::getEnv('_APP_FUNCTIONS_MEMORY', 512) === 0) { $runtimeSpecs[] = $spec; } } diff --git a/src/Appwrite/Functions/Validator/RuntimeSpecification.php b/src/Appwrite/Functions/Validator/RuntimeSpecification.php index 22311838f6..a41ea0a540 100644 --- a/src/Appwrite/Functions/Validator/RuntimeSpecification.php +++ b/src/Appwrite/Functions/Validator/RuntimeSpecification.php @@ -34,7 +34,7 @@ class RuntimeSpecification extends Validator $allowedSpecifications = []; foreach ($this->specifications as $size => $values) { - if ($values['cpus'] <= $this->maxCpus && $values['memory'] <= $this->maxMemory) { + if (($values['cpus'] <= $this->maxCpus || $this->maxCpus === 0) && ($values['memory'] <= $this->maxMemory || $this->maxMemory === 0)) { if (!empty($this->plan) && array_key_exists('runtimeSpecifications', $this->plan)) { if (!\in_array($size, $this->plan['runtimeSpecifications'])) { continue;