mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 03:42:08 +08:00
fix: msg cache timeout.
This commit is contained in:
parent
51bb55585f
commit
7969f56d44
@ -1,5 +1,3 @@
|
|||||||
prometheus:
|
prometheus:
|
||||||
enable: true
|
enable: true
|
||||||
ports: [ 20108, 20109, 20110, 20111 ]
|
ports: [ 20108, 20109, 20110, 20111 ]
|
||||||
|
|
||||||
msgCacheTimeout: 86400
|
|
||||||
@ -88,7 +88,7 @@ func Start(ctx context.Context, index int, config *Config) error {
|
|||||||
client.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials()),
|
client.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||||
grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, "round_robin")))
|
grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, "round_robin")))
|
||||||
//todo MsgCacheTimeout
|
//todo MsgCacheTimeout
|
||||||
msgModel := cache.NewMsgCache(rdb, 86400, config.RedisConfig.EnablePipeline)
|
msgModel := cache.NewMsgCache(rdb, config.RedisConfig.EnablePipeline)
|
||||||
seqModel := cache.NewSeqCache(rdb)
|
seqModel := cache.NewSeqCache(rdb)
|
||||||
msgDocModel, err := mgo.NewMsgMongo(mgocli.GetDB())
|
msgDocModel, err := mgo.NewMsgMongo(mgocli.GetDB())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -86,7 +86,7 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
//todo MsgCacheTimeout
|
//todo MsgCacheTimeout
|
||||||
msgModel := cache.NewMsgCache(rdb, 86400, config.RedisConfig.EnablePipeline)
|
msgModel := cache.NewMsgCache(rdb, config.RedisConfig.EnablePipeline)
|
||||||
seqModel := cache.NewSeqCache(rdb)
|
seqModel := cache.NewSeqCache(rdb)
|
||||||
conversationClient := rpcclient.NewConversationRpcClient(client, config.Share.RpcRegisterName.Conversation)
|
conversationClient := rpcclient.NewConversationRpcClient(client, config.Share.RpcRegisterName.Conversation)
|
||||||
userRpcClient := rpcclient.NewUserRpcClient(client, config.Share.RpcRegisterName.User, config.Share.IMAdminUserID)
|
userRpcClient := rpcclient.NewUserRpcClient(client, config.Share.RpcRegisterName.User, config.Share.IMAdminUserID)
|
||||||
|
|||||||
@ -185,8 +185,7 @@ type MsgGateway struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MsgTransfer struct {
|
type MsgTransfer struct {
|
||||||
Prometheus Prometheus `mapstructure:"prometheus"`
|
Prometheus Prometheus `mapstructure:"prometheus"`
|
||||||
MsgCacheTimeout int `mapstructure:"msgCacheTimeout"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Push struct {
|
type Push struct {
|
||||||
|
|||||||
4
pkg/common/db/cache/msg.go
vendored
4
pkg/common/db/cache/msg.go
vendored
@ -31,6 +31,8 @@ import (
|
|||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const msgCacheTimeout = 86400
|
||||||
|
|
||||||
const (
|
const (
|
||||||
maxSeq = "MAX_SEQ:"
|
maxSeq = "MAX_SEQ:"
|
||||||
minSeq = "MIN_SEQ:"
|
minSeq = "MIN_SEQ:"
|
||||||
@ -82,7 +84,7 @@ type MsgCache interface {
|
|||||||
// return &msgCache{rdb: client, msgCacheTimeout: msgCacheTimeout, redisConf: redisConf}
|
// return &msgCache{rdb: client, msgCacheTimeout: msgCacheTimeout, redisConf: redisConf}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
func NewMsgCache(client redis.UniversalClient, msgCacheTimeout time.Duration, redisEnablePipeline bool) MsgCache {
|
func NewMsgCache(client redis.UniversalClient, redisEnablePipeline bool) MsgCache {
|
||||||
return &msgCache{rdb: client, msgCacheTimeout: msgCacheTimeout, redisEnablePipeline: redisEnablePipeline}
|
return &msgCache{rdb: client, msgCacheTimeout: msgCacheTimeout, redisEnablePipeline: redisEnablePipeline}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user