This commit is contained in:
wangchuxiao 2022-09-09 16:26:57 +08:00
parent 74c2bafc9b
commit 98dde67f65
3 changed files with 10 additions and 15 deletions

View File

@ -115,7 +115,7 @@ services:
open_im_server: open_im_server:
image: openim/open_im_server:v2.3.1 image: openim/open_im_server:v2.3.2
container_name: open_im_server container_name: open_im_server
volumes: volumes:
- ./logs:/Open-IM-Server/logs - ./logs:/Open-IM-Server/logs

View File

@ -40,9 +40,8 @@ var (
func Init() { func Init() {
cmdCh = make(chan Cmd2Value, 10000) cmdCh = make(chan Cmd2Value, 10000)
w = new(sync.Mutex) w = new(sync.Mutex)
persistentCH.Init() // 订阅ws2mschat 消费到 mysql persistentCH.Init() // ws2mschat save mysql
historyCH.Init(cmdCh) // 订阅ws2mschat 如果可靠性存储 消费到 incrseq 再存入mongo 再push || 非可靠性 直接incr再push 初始化ws2mschat historyCH.Init(cmdCh) //
historyMongoCH.Init()
onlineTopicStatus = OnlineTopicVacancy onlineTopicStatus = OnlineTopicVacancy
//offlineHistoryCH.Init(cmdCh) //offlineHistoryCH.Init(cmdCh)
statistics.NewStatistics(&singleMsgSuccessCount, config.Config.ModuleName.MsgTransferName, fmt.Sprintf("%d second singleMsgCount insert to mongo", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval) statistics.NewStatistics(&singleMsgSuccessCount, config.Config.ModuleName.MsgTransferName, fmt.Sprintf("%d second singleMsgCount insert to mongo", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval)

View File

@ -23,11 +23,7 @@ import (
) )
var ( var (
// msgInsertMysqlProcessed perometheus.Countr msgInsertMysqlProcessed prometheus.Counter
msgInsertMysqlProcessed = promauto.NewCounter(prometheus.CounterOpts{
Name: "insert_mysql_msg_total",
Help: "The total number of msg insert mysql events",
})
) )
type PersistentConsumerHandler struct { type PersistentConsumerHandler struct {
@ -41,12 +37,12 @@ func (pc *PersistentConsumerHandler) Init() {
pc.persistentConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0, pc.persistentConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic}, OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic},
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMySql) config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMySql)
// if config.Config.Prometheus.Enable { if config.Config.Prometheus.Enable {
// msgInsertMysqlProcessed = promauto.NewCounter(prometheus.CounterOpts{ msgInsertMysqlProcessed = promauto.NewCounter(prometheus.CounterOpts{
// Name: "insert_mysql_msg_total", Name: "insert_mysql_msg_total",
// Help: "The total number of msg insert mysql events", Help: "The total number of msg insert mysql events",
// }) })
// } }
} }
func (pc *PersistentConsumerHandler) handleChatWs2Mysql(cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) { func (pc *PersistentConsumerHandler) handleChatWs2Mysql(cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) {