mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 23:29:08 +03:00
IOPS logic wrong way round
This commit is contained in:
1 parent
aa6c0f6b9c
commit
76b8fc4fc5
2 files changed
+5
-26
No files matched your search
@@ -191,17 +191,17 @@ export function getAvailableComputeOptions(availableAddons: any[], projectCloudP
|
||||
|
||||
export const calculateMaxIopsAllowedForDiskSizeWithGp3 = (totalSize: number) => {
|
||||
if (!totalSize) throw Error('Total size is required')
|
||||
return Math.min(1000 * totalSize, 256000)
|
||||
return Math.min(3000 * totalSize, 16000)
|
||||
}
|
||||
|
||||
export const calculateDiskSizeRequiredForIopsWithGp3 = (iops: number) => {
|
||||
if (!iops) throw Error('IOPS is required')
|
||||
return Math.max(1, Math.ceil(iops / 1000))
|
||||
return Math.max(1, Math.ceil(iops / 3000))
|
||||
}
|
||||
|
||||
export const calculateMaxIopsAllowedForDiskSizeWithio2 = (totalSize: number) => {
|
||||
if (!totalSize) throw Error('Total size is required')
|
||||
return Math.min(500 * totalSize, 16000)
|
||||
return Math.min(500 * totalSize, 256000)
|
||||
}
|
||||
|
||||
export const calculateDiskSizeRequiredForIopsWithIo2 = (iops: number) => {
|
||||
|
||||
@@ -257,33 +257,10 @@ export function DiskManagementForm() {
|
||||
const disableIopsInput =
|
||||
RESTRICTED_COMPUTE_FOR_IOPS_ON_GP3.includes(watchedComputeSize) && watchedStorageType === 'gp3'
|
||||
|
||||
const disableThroughputInput =
|
||||
RESTRICTED_COMPUTE_FOR_THROUGHPUT_ON_GP3.includes(watchedComputeSize) &&
|
||||
watchedStorageType === 'gp3'
|
||||
|
||||
const currentCompute = (addons?.selected_addons ?? []).find((x) => x.type === 'compute_instance')
|
||||
?.variant
|
||||
const maxIopsBasedOnCompute =
|
||||
COMPUTE_MAX_IOPS[watchedComputeSize as keyof typeof COMPUTE_MAX_IOPS]
|
||||
const maxThroughputBasedOnCompute =
|
||||
COMPUTE_MAX_THROUGHPUT[watchedComputeSize as keyof typeof COMPUTE_MAX_THROUGHPUT]
|
||||
|
||||
const { includedDiskGB: includedDiskGBMeta } =
|
||||
PLAN_DETAILS?.[planId as keyof typeof PLAN_DETAILS] ?? {}
|
||||
const includedDiskGB = includedDiskGBMeta[watchedStorageType]
|
||||
|
||||
const minIOPS = IOPS_RANGE[watchedStorageType]?.min ?? 0
|
||||
const maxIOPS =
|
||||
watchedStorageType === 'gp3'
|
||||
? Math.min(500 * watchedTotalSize, IOPS_RANGE[DiskType.GP3].max)
|
||||
: Math.min(1000 * watchedTotalSize, IOPS_RANGE[DiskType.IO2].max)
|
||||
const minThroughput =
|
||||
watchedStorageType === 'gp3' ? THROUGHPUT_RANGE[watchedStorageType]?.min ?? 0 : 0
|
||||
const maxThroughput =
|
||||
watchedStorageType === 'gp3'
|
||||
? Math.min(0.25 * watchedIOPS, THROUGHPUT_RANGE[DiskType.GP3].max)
|
||||
: undefined
|
||||
|
||||
/**
|
||||
* Price calculations
|
||||
*/
|
||||
@@ -666,6 +643,8 @@ export function DiskManagementForm() {
|
||||
// only trigger provisionedIOPS due to other input being hidden
|
||||
await form.trigger('provisionedIOPS')
|
||||
await form.trigger('totalSize')
|
||||
|
||||
trigger('provisionedIOPS')
|
||||
}}
|
||||
defaultValue={field.value}
|
||||
disabled={disableInput}
|
||||
|
||||
Reference in new issue
Block a user