Fix session util error (#5370)

Fix session util error.

Signed-off-by: godchen <qingxiang.chen@zilliz.com>
pull/5397/head
godchen 2021-05-24 16:31:06 +08:00 committed by GitHub
parent 3e73775cc1
commit 042a061123
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -190,7 +190,7 @@ func (s *Session) registerService() (<-chan *clientv3.LeaseKeepAliveResponse, er
} }
err := retry.Retry(DefaultRetryTimes, time.Millisecond*500, registerFn) err := retry.Retry(DefaultRetryTimes, time.Millisecond*500, registerFn)
if err != nil { if err != nil {
return ch, nil return nil, err
} }
return ch, nil return ch, nil
} }
@ -208,9 +208,11 @@ func (s *Session) processKeepAliveResponse(ch <-chan *clientv3.LeaseKeepAliveRes
case resp, ok := <-ch: case resp, ok := <-ch:
if !ok { if !ok {
close(failCh) close(failCh)
return
} }
if resp == nil { if resp == nil {
close(failCh) close(failCh)
return
} }
failCh <- true failCh <- true
} }