Adds 1kB and 2kB units (#915)

Signed-off-by: Eric tyrrell <eric.tyrrell18+github@gmail.com>
This commit is contained in:
Eric Tyrrell 2023-09-19 21:40:29 -04:00 committed by GitHub
parent c06e57db4e
commit e3eaa91c0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,7 +129,7 @@ func (s *pgSetting) normaliseUnit() (val float64, unit string, err error) {
return
case "ms", "s", "min", "h", "d":
unit = "seconds"
case "B", "kB", "MB", "GB", "TB", "4kB", "8kB", "16kB", "32kB", "64kB", "16MB", "32MB", "64MB":
case "B", "kB", "MB", "GB", "TB", "1kB", "2kB", "4kB", "8kB", "16kB", "32kB", "64kB", "16MB", "32MB", "64MB":
unit = "bytes"
default:
err = fmt.Errorf("Unknown unit for runtime variable: %q", s.unit)
@ -158,6 +158,10 @@ func (s *pgSetting) normaliseUnit() (val float64, unit string, err error) {
val *= math.Pow(2, 30)
case "TB":
val *= math.Pow(2, 40)
case "1kB":
val *= math.Pow(2, 10)
case "2kB":
val *= math.Pow(2, 11)
case "4kB":
val *= math.Pow(2, 12)
case "8kB":