mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 10:59:32 +08:00
Fix panic due to return nil pulsar client (#27429)
Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
parent
01c4499a12
commit
f962fc186f
@ -48,8 +48,10 @@ var once sync.Once
|
||||
// NewClient creates a pulsarClient object
|
||||
// according to the parameter opts of type pulsar.ClientOptions
|
||||
func NewClient(tenant string, namespace string, opts pulsar.ClientOptions) (*pulsarClient, error) {
|
||||
var err error
|
||||
once.Do(func() {
|
||||
c, err := pulsar.NewClient(opts)
|
||||
var c pulsar.Client
|
||||
c, err = pulsar.NewClient(opts)
|
||||
if err != nil {
|
||||
log.Error("Failed to set pulsar client: ", zap.Error(err))
|
||||
return
|
||||
@ -61,7 +63,7 @@ func NewClient(tenant string, namespace string, opts pulsar.ClientOptions) (*pul
|
||||
}
|
||||
sc = cli
|
||||
})
|
||||
return sc, nil
|
||||
return sc, err
|
||||
}
|
||||
|
||||
// CreateProducer create a pulsar producer from options
|
||||
|
Loading…
Reference in New Issue
Block a user