From b5d7423849ec9b52f72c35651729b61607f85b6c Mon Sep 17 00:00:00 2001 From: asier-isayas Date: Mon, 10 Mar 2025 11:35:17 -0400 Subject: [PATCH] Set default RU throughput for Production workload accounts to be 10k (#2070) * assign default throughput based on workload type * combined common logic * fix unit tests * add tests * update tests * npm run format * Set default RU throughput for Production workload accounts to be 10k * remove unused method * refactor --------- Co-authored-by: Asier Isayas --- .../Controls/ThroughputInput/ThroughputInput.tsx | 16 ++++++++++++---- src/Utils/AutoPilotUtils.ts | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx b/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx index 64676bbc3..9fb5b28f9 100644 --- a/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx +++ b/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx @@ -35,12 +35,20 @@ export const ThroughputInput: FunctionComponent = ({ setIsThroughputCapExceeded, onCostAcknowledgeChange, }: ThroughputInputProps) => { - const defaultThroughput: number = + let defaultThroughput: number; + const workloadType: Constants.WorkloadType = getWorkloadType(); + + if ( isFreeTier || isQuickstart || - [Constants.WorkloadType.Learning, Constants.WorkloadType.DevelopmentTesting].includes(getWorkloadType()) - ? AutoPilotUtils.autoPilotThroughput1K - : AutoPilotUtils.autoPilotThroughput4K; + [Constants.WorkloadType.Learning, Constants.WorkloadType.DevelopmentTesting].includes(workloadType) + ) { + defaultThroughput = AutoPilotUtils.autoPilotThroughput1K; + } else if (workloadType === Constants.WorkloadType.Production) { + defaultThroughput = AutoPilotUtils.autoPilotThroughput10K; + } else { + defaultThroughput = AutoPilotUtils.autoPilotThroughput4K; + } const [isAutoscaleSelected, setIsAutoScaleSelected] = useState(true); const [throughput, setThroughput] = useState(defaultThroughput); diff --git a/src/Utils/AutoPilotUtils.ts b/src/Utils/AutoPilotUtils.ts index 57d1bf5f2..c2ed7c61e 100644 --- a/src/Utils/AutoPilotUtils.ts +++ b/src/Utils/AutoPilotUtils.ts @@ -1,6 +1,7 @@ export const autoPilotThroughput1K = 1000; export const autoPilotIncrementStep = 1000; export const autoPilotThroughput4K = 4000; +export const autoPilotThroughput10K = 10000; export function isValidAutoPilotThroughput(maxThroughput: number): boolean { if (!maxThroughput) {