Skip to content

Commit

Permalink
Bug: component check (#2054)
Browse files Browse the repository at this point in the history
* Error not handled (#2040)

* delete

* add context deadline exceeded

* Error not handled

* Error not handled

* Error not handled

* Error not handled

* feat: add local cache for high frequency reads (#2036)

* feat: msg local cache

* feat: msg local cache

* feat: msg local cache

* feat: msg local cache

* feat: msg local cache

* feat: msg local cache

* fix: mongo

* fix: mongo

* fix: mongo

* openim.yaml

* localcache

* localcache

* localcache

* localcache

* localcache

* localcache

* localcache

* localcache

* localcache

* local cache

* local cache

* local cache

* local cache

* fix: GroupApplicationAcceptedNotification

* fix: GroupApplicationAcceptedNotification

* fix: NotificationUserInfoUpdate

* feat: cache add single-flight and timing-wheel.

* feat: local cache

* feat: local cache

* feat: local cache

* feat: cache add single-flight and timing-wheel.

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: local cache

* feat: msg rpc local cache

* feat: msg rpc local cache

* feat: msg rpc local cache

* feat: msg rpc local cache

* feat: msg rpc local cache

* feat: msg rpc local cache

* refactor: refactor the code of push and optimization.

* cicd: robot automated Change

* refactor: rename cache.

* merge

* fix: refactor project dir avoid import cycle.

* update tools

* merge

* feat: conversation FindRecvMsgNotNotifyUserIDs

* feat: conversation FindRecvMsgNotNotifyUserIDs

* feat: conversation FindRecvMsgNotNotifyUserIDs

* merge

* merge the latest main

---------

Co-authored-by: Gordon <46924906+FGadvancer@users.noreply.github.com>
Co-authored-by: withchao <withchao@users.noreply.github.com>

* configGetEnv failed,err:string to int failed: strconv.Atoi: parsing "openim_v3": invalid syntaxr

* Fix bug Remove duplicate function definitions (#2033)

* delete

* delete log

* Fix bug configGetEnv failed,err:string to int failed: strconv.Atoi: parsing "openim_v3": invalid syntaxr (#2044)

* delete

* add context deadline exceeded

* Error not handled

* Error not handled

* Error not handled

* Error not handled

* configGetEnv failed,err:string to int failed: strconv.Atoi: parsing "openim_v3": invalid syntaxr

* delete log (#2047)

* test

Signed-off-by: unknown <44203734@qq.com>

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

* fix bug: component check

---------

Signed-off-by: unknown <44203734@qq.com>
Co-authored-by: chao <48119764+withchao@users.noreply.github.com>
Co-authored-by: Gordon <46924906+FGadvancer@users.noreply.github.com>
Co-authored-by: withchao <withchao@users.noreply.github.com>
  • Loading branch information
4 people committed Mar 8, 2024
1 parent a938e03 commit 7730f60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 29 deletions.
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYE
firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVAyRLQwGn/+4=
firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIwjt8toICdV5Wh9ptHs=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/IBM/sarama v1.41.3 h1:MWBEJ12vHC8coMjdEXFq/6ftO6DUZnQlFYcxtOJFa7c=
github.com/IBM/sarama v1.41.3/go.mod h1:Xxho9HkHd4K/MDUo/T/sOqwtX/17D33++E9Wib6hUdQ=
github.com/OpenIMSDK/protocol v0.0.53 h1:PtePLTqMYRHjWSf8XIL3x5JRC3YoySTMA6tRKfbUjQY=
github.com/OpenIMSDK/protocol v0.0.53/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
github.com/OpenIMSDK/tools v0.0.29 h1:NS4PEwYl9sX3SWsMjDOLVxMo3LcTWREMr+2cjzWjcqc=
github.com/OpenIMSDK/tools v0.0.29/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
github.com/IBM/sarama v1.42.2 h1:VoY4hVIZ+WQJ8G9KNY/SQlWguBQXQ9uvFPOnrcu8hEw=
github.com/IBM/sarama v1.42.2/go.mod h1:FLPGUGwYqEs62hq2bVG6Io2+5n+pS6s/WOXVKWSLFtE=
github.com/OpenIMSDK/protocol v0.0.55 h1:eBjg8DyuhxGmuCUjpoZjg6MJJJXU/xJ3xJwFhrn34yA=
Expand Down
35 changes: 12 additions & 23 deletions tools/component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"github.com/OpenIMSDK/tools/errs"

"github.com/openimsdk/open-im-server/v3/pkg/common/config"

"gopkg.in/yaml.v3"
)

Expand Down Expand Up @@ -80,7 +79,6 @@ func main() {
fmt.Printf("configGetEnv failed, err:%v", err)
return
}


checks := []checkFunc{
//{name: "Mysql", function: checkMysql},
Expand All @@ -95,48 +93,39 @@ func main() {
if i != 0 {
time.Sleep(1 * time.Second)
}
fmt.Printf("Checking components Round %v...\n", i+1)
fmt.Printf("Checking components round %v...\n", i+1)

var err error
allSuccess := true
for index, check := range checks {
if !check.flag {
err = check.function(check.config)
if err != nil {

allSuccess = false
component.ErrorPrint(fmt.Sprintf("Check component: %s, failed: %s", check.name, err.Error()))
if check.name == "Minio" {
if errors.Is(err, errMinioNotEnabled) {
fmt.Println(err.Error(), " check ", check.name)
checks[index].flag = true
}
if errors.Is(err, errSignEndPoint) {
if errors.Is(err, errMinioNotEnabled) ||
errors.Is(err, errSignEndPoint) ||
errors.Is(err, errApiURL) {
fmt.Fprintf(os.Stderr, err.Error(), " check ", check.name)
checks[index].flag = true
continue
}
}


component.ErrorPrint(fmt.Sprintf("Starting %s failed:%v.", check.name, errs.Unwrap(err).Error()))
if strings.Contains(errs.Unwrap(err).Error(), "connection refused") ||
strings.Contains(errs.Unwrap(err).Error(), "timeout") ||
strings.Contains(errs.Unwrap(err).Error(), "context deadline exceeded") {
component.ErrorPrint(fmt.Sprintf("try check connection %s", check.name))
allSuccess = false
break
}
} else {
checks[index].flag = true
component.SuccessPrint(fmt.Sprintf("%s connected successfully", check.name))
}
}
}

}
if allSuccess {
component.SuccessPrint("All components started successfully!")
return
}
}
component.ErrorPrint("Some components started failed!")
component.ErrorPrint("Some components checked failed!")
os.Exit(-1)
}

Expand Down Expand Up @@ -174,13 +163,13 @@ func checkRedis(config *config.GlobalConfig) error {
// checkMinio checks the MinIO connection
func checkMinio(config *config.GlobalConfig) error {
if strings.Contains(config.Object.ApiURL, "127.0.0.1") {
return errs.Wrap(errApiURL, "config.Object.ApiURL: "+config.Object.ApiURL)
return errs.Wrap(errApiURL)
}
if config.Object.Enable != "minio" {
return errs.Wrap(errMinioNotEnabled, "config.Object.Enable: "+config.Object.Enable)
return errs.Wrap(errMinioNotEnabled)
}
if strings.Contains(config.Object.Minio.Endpoint, "127.0.0.1") {
return errs.Wrap(errSignEndPoint, "config.Object.Minio.Endpoint: "+config.Object.Minio.Endpoint)
return errs.Wrap(errSignEndPoint)
}

minio := &component.Minio{
Expand Down

0 comments on commit 7730f60

Please sign in to comment.