fix(app): parse nan in validation check [EE-6714] (#11246)

pull/11253/head
Ali 2024-02-26 09:20:54 +13:00 committed by GitHub
parent 3caf1ddb7d
commit f6beedf0d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -99,6 +99,8 @@ function hasSuitableNode(
cpuLimit: number,
nodeLimits: NodesLimits
) {
const nanParsedMemoryLimit = Number.isNaN(memoryLimit) ? 0 : memoryLimit;
const nanParsedCPULimit = Number.isNaN(cpuLimit) ? 0 : cpuLimit;
// transform the nodelimits from bytes to MB
const limits = Object.values(nodeLimits).map((nodeLimit) => ({
...nodeLimit,
@ -108,6 +110,8 @@ function hasSuitableNode(
}));
// make sure there's a node available with enough memory and cpu
return limits.some(
(nodeLimit) => nodeLimit.Memory >= memoryLimit && nodeLimit.CPU >= cpuLimit
(nodeLimit) =>
nodeLimit.Memory >= nanParsedMemoryLimit &&
nodeLimit.CPU >= nanParsedCPULimit
);
}