etcdserver: compute max request bytes humanized string once

No need to compute the request size limit everytime in runtime

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
release-3.5
Gyuho Lee 2020-05-09 23:11:45 -07:00
parent b95f135e10
commit 89a3a24d5a
1 changed files with 3 additions and 2 deletions

View File

@ -104,7 +104,8 @@ const (
)
var (
storeMemberAttributeRegexp = regexp.MustCompile(path.Join(membership.StoreMembersPrefix, "[[:xdigit:]]{1,16}", "attributes"))
recommendedMaxRequestBytesString = humanize.Bytes(uint64(recommendedMaxRequestBytes))
storeMemberAttributeRegexp = regexp.MustCompile(path.Join(membership.StoreMembersPrefix, "[[:xdigit:]]{1,16}", "attributes"))
)
func init() {
@ -298,7 +299,7 @@ func NewServer(cfg ServerConfig) (srv *EtcdServer, err error) {
zap.Uint("max-request-bytes", cfg.MaxRequestBytes),
zap.String("max-request-size", humanize.Bytes(uint64(cfg.MaxRequestBytes))),
zap.Int("recommended-request-bytes", recommendedMaxRequestBytes),
zap.String("recommended-request-size", humanize.Bytes(uint64(recommendedMaxRequestBytes))),
zap.String("recommended-request-size", recommendedMaxRequestBytesString),
)
}