fix: fix scripts functions upload

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong (cubxxw) 2024-01-12 17:48:41 +08:00
parent 4e4564c9cc
commit f9623807fb

View File

@ -148,12 +148,18 @@ func checkMongo() (string, error) {
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 "", err // Handle the error as needed
return "", errs.Wrap(errStr(err, str))
}
defer client.Disconnect(context.Background())
if err = client.Ping(context.TODO(), nil); err != nil {
return "", errs.Wrap(errStr(err, str))
}
ctx, cancel = context.WithTimeout(context.Background(), mongoConnTimeout)
defer cancel()