From 90255e9efa82ac94d479e59e289210fa6afa88a5 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Mon, 25 Jul 2022 09:52:05 +0300 Subject: [PATCH] [#291] pool: Use more robust way to init methods Signed-off-by: Denis Kirillov --- pool/pool.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pool/pool.go b/pool/pool.go index c475b6ab..42af3693 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -135,6 +135,7 @@ const ( methodObjectHead methodObjectRange methodSessionCreate + methodLast ) // String implements fmt.Stringer. @@ -170,14 +171,16 @@ func (m MethodIndex) String() string { return "objectRange" case methodSessionCreate: return "sessionCreate" + case methodLast: + return "it's a system name rather than a method" default: return "unknown" } } func newClientStatusMonitor(addr string, errorThreshold uint32) clientStatusMonitor { - methods := make([]*methodStatus, methodSessionCreate+1) - for i := methodBalanceGet; i <= methodSessionCreate; i++ { + methods := make([]*methodStatus, methodLast) + for i := methodBalanceGet; i < methodLast; i++ { methods[i] = &methodStatus{name: i.String()} }