From 2044e1e9985fafb78bc03fffa5290a186ee5d3af Mon Sep 17 00:00:00 2001 From: tyltr Date: Fri, 18 Mar 2022 15:19:34 +0800 Subject: [PATCH] reduce unnessary type assart (#1254) --- args.go | 2 +- client.go | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/args.go b/args.go index a8e43941a8..7c55943651 100644 --- a/args.go +++ b/args.go @@ -230,7 +230,7 @@ func (a *Args) SetBytesKV(key, value []byte) { // SetNoValue sets only 'key' as argument without the '='. // -// Only key in argumemt, like key1&key2 +// Only key in argument, like key1&key2 func (a *Args) SetNoValue(key string) { a.args = setArg(a.args, key, "", argsNoValue) } diff --git a/client.go b/client.go index e3173bebf3..ee05507a86 100644 --- a/client.go +++ b/client.go @@ -2916,14 +2916,15 @@ func (c *pipelineConnClient) getClientName() []byte { var errPipelineConnStopped = errors.New("pipeline connection has been stopped") -func acquirePipelineWork(pool *sync.Pool, timeout time.Duration) *pipelineWork { +func acquirePipelineWork(pool *sync.Pool, timeout time.Duration) (w *pipelineWork) { v := pool.Get() - if v == nil { - v = &pipelineWork{ + if v != nil { + w = v.(*pipelineWork) + } else { + w = &pipelineWork{ done: make(chan struct{}, 1), } } - w := v.(*pipelineWork) if timeout > 0 { if w.t == nil { w.t = time.NewTimer(timeout)