fix: msg cache timeout.

pull/2148/head
Gordon 1 year ago
parent 51bb55585f
commit 7969f56d44

@ -1,5 +1,3 @@
prometheus:
enable: true
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()),
grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, "round_robin")))
//todo MsgCacheTimeout
msgModel := cache.NewMsgCache(rdb, 86400, config.RedisConfig.EnablePipeline)
msgModel := cache.NewMsgCache(rdb, config.RedisConfig.EnablePipeline)
seqModel := cache.NewSeqCache(rdb)
msgDocModel, err := mgo.NewMsgMongo(mgocli.GetDB())
if err != nil {

@ -86,7 +86,7 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg
return err
}
//todo MsgCacheTimeout
msgModel := cache.NewMsgCache(rdb, 86400, config.RedisConfig.EnablePipeline)
msgModel := cache.NewMsgCache(rdb, config.RedisConfig.EnablePipeline)
seqModel := cache.NewSeqCache(rdb)
conversationClient := rpcclient.NewConversationRpcClient(client, config.Share.RpcRegisterName.Conversation)
userRpcClient := rpcclient.NewUserRpcClient(client, config.Share.RpcRegisterName.User, config.Share.IMAdminUserID)

@ -186,7 +186,6 @@ type MsgGateway struct {
type MsgTransfer struct {
Prometheus Prometheus `mapstructure:"prometheus"`
MsgCacheTimeout int `mapstructure:"msgCacheTimeout"`
}
type Push struct {

@ -31,6 +31,8 @@ import (
"golang.org/x/sync/errgroup"
)
const msgCacheTimeout = 86400
const (
maxSeq = "MAX_SEQ:"
minSeq = "MIN_SEQ:"
@ -82,7 +84,7 @@ type MsgCache interface {
// 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}
}

Loading…
Cancel
Save