mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-16 12:47:19 +08:00
Go: add more commands and GCS supports (#16741)
### Summary 1. GCS supports 2. More commands ``` RAGFlow(admin)> ping store; SUCCESS RAGFlow(admin)> ping engine; SUCCESS RAGFlow(admin)> ping cache; SUCCESS ``` --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -19,6 +19,7 @@ package elasticsearch
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -59,6 +60,7 @@ func NewEngine(cfg interface{}) (*elasticsearchEngine, error) {
|
||||
Transport: &http.Transport{
|
||||
MaxIdleConnsPerHost: 10,
|
||||
ResponseHeaderTimeout: 30 * time.Second,
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -123,18 +123,18 @@ func (n *NatsEngine) ShowMessageQueue() (map[string]string, error) {
|
||||
result["message_count"] = strconv.FormatUint(info.State.Msgs, 10)
|
||||
|
||||
consumer, err := n.stream.Consumer(ctx, "RAGFLOW_CONSUMER")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get existing consumer: %w", err)
|
||||
if err == nil {
|
||||
var consumerInfo *jetstream.ConsumerInfo
|
||||
consumerInfo, err = consumer.Info(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get consumer info: %w", err)
|
||||
}
|
||||
result["pending_count"] = strconv.FormatUint(consumerInfo.NumPending, 10)
|
||||
result["waiting_count"] = strconv.Itoa(consumerInfo.NumWaiting)
|
||||
result["ack_pending_count"] = strconv.Itoa(consumerInfo.NumAckPending)
|
||||
result["redelivered_count"] = strconv.Itoa(consumerInfo.NumRedelivered)
|
||||
}
|
||||
|
||||
consumerInfo, err := consumer.Info(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get consumer info: %w", err)
|
||||
}
|
||||
result["pending_count"] = strconv.FormatUint(consumerInfo.NumPending, 10)
|
||||
result["waiting_count"] = strconv.Itoa(consumerInfo.NumWaiting)
|
||||
result["ack_pending_count"] = strconv.Itoa(consumerInfo.NumAckPending)
|
||||
result["redelivered_count"] = strconv.Itoa(consumerInfo.NumRedelivered)
|
||||
return result, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user