INNER CODE UNIT · Go
downscale
brexhq/substation · cmd/aws/lambda/autoscale/main.go:308
func downscale(shards float64) int32 {
switch {
case shards < 5:
return int32(math.Ceil(shards / 2))
case shards < 13:
return int32(math.Ceil(shards / 1.75))
case shards < 33:
return int32(math.Ceil(shards / 1.5))
default:
return int32(math.Ceil(shards / 1.25))
}
}
func upscale(shards float64) int32 {
switch {
case shards < 5:
return int32(math.Floor(shards * 2))
case shards < 13: