Commit 7ea1556b authored by iamhujiebin's avatar iamhujiebin

feat:调整速率

parent 8e265720
...@@ -22,8 +22,8 @@ import ( ...@@ -22,8 +22,8 @@ import (
"time" "time"
) )
const SEND_WORKER = 2000 // 消费端协程数量 const SEND_WORKER = 1 // 消费端协程数量
const MONITOR_LENGTH = 100 // 队列告警数量 const MONITOR_LENGTH = 1000 // 队列告警数量
const SocketQueueSendGift = "socket:queue:send_gift" const SocketQueueSendGift = "socket:queue:send_gift"
var userClient userCenter.UserClient var userClient userCenter.UserClient
...@@ -92,7 +92,7 @@ func main() { ...@@ -92,7 +92,7 @@ func main() {
mylogrus.MyLog.Infof("cron sendGiftChan start") mylogrus.MyLog.Infof("cron sendGiftChan start")
// 8核 n send + 4 blpop // 8核 n send + 4 blpop
sendGiftChan = make(chan *SendGiftMsg, SEND_WORKER) sendGiftChan = make(chan *SendGiftMsg, SEND_WORKER)
for i := 0; i < 4; i++ { for i := 0; i < 1; i++ {
go func() { go func() {
deal() deal()
}() }()
...@@ -107,7 +107,7 @@ func main() { ...@@ -107,7 +107,7 @@ func main() {
} }
func check() { func check() {
tick := time.NewTicker(time.Second * 3) tick := time.NewTicker(time.Second * 30)
defer tick.Stop() defer tick.Stop()
for { for {
select { select {
...@@ -148,7 +148,7 @@ func deal() { ...@@ -148,7 +148,7 @@ func deal() {
} }
sendGiftChan <- msg sendGiftChan <- msg
} }
time.Sleep(time.Second) // 控制全服banner速率 time.Sleep(time.Second * 5) // 控制全服banner速率
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment