mirror of
https://github.com/minio/minio.git
synced 2025-01-12 07:23:23 -05:00
fix panic when checking if es/nats event target is active (#9587)
This commit is contained in:
parent
94f1a1dea3
commit
2ecf5ba1de
@ -103,6 +103,13 @@ func (target *ElasticsearchTarget) IsActive() (bool, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
if target.client == nil {
|
||||
client, err := newClient(target.args)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
target.client = client
|
||||
}
|
||||
_, code, err := target.client.Ping(target.args.URL.String()).HttpHeadOnly(true).Do(ctx)
|
||||
if err != nil {
|
||||
if elastic.IsConnErr(err) || elastic.IsContextErr(err) || xnet.IsNetworkOrHostDown(err) {
|
||||
|
@ -106,7 +106,7 @@ func (target *NSQTarget) HasQueueStore() bool {
|
||||
|
||||
// IsActive - Return true if target is up and active
|
||||
func (target *NSQTarget) IsActive() (bool, error) {
|
||||
if target.producer != nil {
|
||||
if target.producer == nil {
|
||||
producer, err := nsq.NewProducer(target.args.NSQDAddress.String(), target.config)
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
Loading…
Reference in New Issue
Block a user