feat: Optimize openim scripts and standard output logs (#1866)

* feat: add component check func

* fix: fix the outpu error

* fix: fix the stderr outpu

* fix: fix the component check func

* fix: fix the error

* fix: fix the output error

* fix: del the disruptions code

* fix the log output format

* fix: fix the tools version

* fix: fix the cycle detection

* fix: fix the error

* fix: fix the flag

* fix: add mongo ping detection

* fix: fix the tools pkg version

* fix: del the err

* feat: support openim readme docs

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>

* feat: support openim readme docs

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>

* feat: support openim readme docs

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>

* fix: fix the minio nil error

* fix: del the repeated wrap and add err print

* fix: fix this bug scripts

* Revert "Check"

---------

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>
Co-authored-by: luhaoling <2198702716@qq.com>
This commit is contained in:
Xinwei Xiong
2024-02-02 21:59:12 +08:00
committed by GitHub
parent af878a96cf
commit 854f8dbd2f
30 changed files with 146 additions and 67 deletions
+3 -2
View File
@@ -54,14 +54,15 @@ func NewMongo() (*Mongo, error) {
defer cancel()
mongoClient, err = mongo.Connect(ctx, options.Client().ApplyURI(uri))
if err == nil {
if err = mongoClient.Ping(ctx, nil); err != nil {
return nil, errs.Wrap(err, uri)
}
return &Mongo{db: mongoClient}, nil
}
if shouldRetry(err) {
fmt.Printf("Failed to connect to MongoDB, retrying: %s\n", err)
time.Sleep(time.Second) // exponential backoff could be implemented here
continue
}
return nil, errs.Wrap(err, uri)
}
return nil, errs.Wrap(err, uri)
}