update release-v3.5 (#1755)

* update release-v3.5

* Update check-all.sh

* Update util.sh
pull/1758/head
Xinwei Xiong 10 months ago committed by GitHub
parent c4a140043c
commit 0aae970298
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,6 +30,7 @@ OPENIM_VERBOSE=4
openim::log::info "\n# Begin to check all openim service"
openim::log::status "Check all dependent service ports"
# Elegant printing function
# Elegant printing function
print_services_and_ports() {
@ -60,7 +61,7 @@ print_services_and_ports "${OPENIM_DEPENDENCY_TARGETS[@]}" "${OPENIM_DEPENDENCY_
# OpenIM check
echo "++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
openim::log::info "\n## Check all dependent service ports"
echo "+++ The port being checked: ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}"
echo "++ The port being checked: ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}"
set +e

File diff suppressed because it is too large Load Diff

@ -33,19 +33,20 @@ import (
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/minio/minio-go/v7"
"github.com/redis/go-redis/v9"
"gopkg.in/yaml.v3"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/redis/go-redis/v9"
"gopkg.in/yaml.v3"
)
const (
// defaultCfgPath is the default path of the configuration file.
defaultCfgPath = "../../../../../config/config.yaml"
minioHealthCheckDuration = 1
maxRetry = 100
maxRetry = 300
componentStartErrCode = 6000
configErrCode = 6001
mongoConnTimeout = 30 * time.Second
)
const (
@ -55,8 +56,7 @@ const (
)
var (
cfgPath = flag.String("c", defaultCfgPath, "Path to the configuration file")
cfgPath = flag.String("c", defaultCfgPath, "Path to the configuration file")
ErrComponentStart = errs.NewCodeError(componentStartErrCode, "ComponentStartErr")
ErrConfig = errs.NewCodeError(configErrCode, "Config file is incorrect")
)
@ -95,7 +95,7 @@ func main() {
for i := 0; i < maxRetry; i++ {
if i != 0 {
time.Sleep(3 * time.Second)
time.Sleep(1 * time.Second)
}
fmt.Printf("Checking components Round %v...\n", i+1)
@ -141,19 +141,25 @@ func getEnv(key, fallback string) string {
return fallback
}
// checkMongo checks the MongoDB connection
// checkMongo checks the MongoDB connection without retries
func checkMongo() (string, error) {
// Use environment variables or fallback to config
uri := getEnv("MONGO_URI", buildMongoURI())
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(uri))
ctx, cancel := context.WithTimeout(context.Background(), mongoConnTimeout)
defer cancel()
str := "ths addr is:" + strings.Join(config.Config.Mongo.Address, ",")
client, err := mongo.Connect(ctx, options.Client().ApplyURI(uri))
if err != nil {
return "", errs.Wrap(errStr(err, str))
}
defer client.Disconnect(context.TODO())
defer client.Disconnect(context.Background())
ctx, cancel = context.WithTimeout(context.Background(), mongoConnTimeout)
defer cancel()
if err = client.Ping(context.TODO(), nil); err != nil {
if err = client.Ping(ctx, nil); err != nil {
return "", errs.Wrap(errStr(err, str))
}
@ -222,8 +228,8 @@ func checkMinio() (string, error) {
defer cancel()
if minioClient.IsOffline() {
// str := fmt.Sprintf("Minio server is offline;%s", str)
// return "", ErrComponentStart.Wrap(str)
str := fmt.Sprintf("Minio server is offline;%s", str)
return "", ErrComponentStart.Wrap(str)
}
// Check for localhost in API URL and Minio SignEndpoint

Loading…
Cancel
Save