mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 21:02:11 +08:00
If MinIO is not being used, then do not perform the MinIO check.
This commit is contained in:
parent
c04c45c34f
commit
55d60a563c
@ -25,8 +25,6 @@ import (
|
|||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/openimsdk/tools/errs"
|
"github.com/openimsdk/tools/errs"
|
||||||
@ -50,22 +48,12 @@ func Start(ctx context.Context, config *CronTaskConfig) error {
|
|||||||
return errs.WrapMsg(err, "failed to register discovery service")
|
return errs.WrapMsg(err, "failed to register discovery service")
|
||||||
}
|
}
|
||||||
client.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials()))
|
client.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||||
ctx, exitBy := context.WithCancelCause(context.Background())
|
|
||||||
ctx = mcontext.SetOpUserID(ctx, config.Share.IMAdminUserID[0])
|
ctx = mcontext.SetOpUserID(ctx, config.Share.IMAdminUserID[0])
|
||||||
conn, err := client.GetConn(ctx, config.Share.RpcRegisterName.Msg)
|
conn, err := client.GetConn(ctx, config.Share.RpcRegisterName.Msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
cli := msg.NewMsgClient(conn)
|
cli := msg.NewMsgClient(conn)
|
||||||
go func() {
|
|
||||||
sigs := make(chan os.Signal, 1)
|
|
||||||
signal.Notify(sigs, syscall.SIGTERM)
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
case s := <-sigs:
|
|
||||||
exitBy(fmt.Errorf("exit signal %s", s))
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
crontab := cron.New()
|
crontab := cron.New()
|
||||||
clearFunc := func() {
|
clearFunc := func() {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
@ -84,5 +72,5 @@ func Start(ctx context.Context, config *CronTaskConfig) error {
|
|||||||
log.ZInfo(ctx, "start cron task", "chatRecordsClearTime", config.CronTask.ChatRecordsClearTime)
|
log.ZInfo(ctx, "start cron task", "chatRecordsClearTime", config.CronTask.ChatRecordsClearTime)
|
||||||
crontab.Start()
|
crontab.Start()
|
||||||
<-ctx.Done()
|
<-ctx.Done()
|
||||||
return context.Cause(ctx)
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,7 +87,6 @@ func initConfig(configDir string) (*config.Mongo, *config.Redis, *config.Kafka,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, nil, nil, err
|
return nil, nil, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
fmt.Println("thirdConfig", thirdConfig)
|
|
||||||
|
|
||||||
if thirdConfig.Object.Enable == "minio" {
|
if thirdConfig.Object.Enable == "minio" {
|
||||||
err = config.LoadConfig(filepath.Join(configDir, cmd.MinioConfigFileName), cmd.ConfigEnvPrefixMap[cmd.MinioConfigFileName], minioConfig)
|
err = config.LoadConfig(filepath.Join(configDir, cmd.MinioConfigFileName), cmd.ConfigEnvPrefixMap[cmd.MinioConfigFileName], minioConfig)
|
||||||
@ -96,8 +95,6 @@ func initConfig(configDir string) (*config.Mongo, *config.Redis, *config.Kafka,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
minioConfig = nil
|
minioConfig = nil
|
||||||
fmt.Println("minioConfig = nil")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
err = config.LoadConfig(filepath.Join(configDir, cmd.ZookeeperConfigFileName), cmd.ConfigEnvPrefixMap[cmd.ZookeeperConfigFileName], zookeeperConfig)
|
err = config.LoadConfig(filepath.Join(configDir, cmd.ZookeeperConfigFileName), cmd.ConfigEnvPrefixMap[cmd.ZookeeperConfigFileName], zookeeperConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user