diff --git a/main.go b/main.go index 6d4eadab3b0382d9636aa67d63d367e8aaa7153a..d8cb4594dcefecbc0ef6cf9f4a247e9ef786ccf9 100644 --- a/main.go +++ b/main.go @@ -22,8 +22,8 @@ import ( "time" ) -const SEND_WORKER = 2000 // 消费端协程数量 -const MONITOR_LENGTH = 100 // 队列告警数量 +const SEND_WORKER = 1 // 消费端协程数量 +const MONITOR_LENGTH = 1000 // 队列告警数量 const SocketQueueSendGift = "socket:queue:send_gift" var userClient userCenter.UserClient @@ -92,7 +92,7 @@ func main() { mylogrus.MyLog.Infof("cron sendGiftChan start") // 8核 n send + 4 blpop sendGiftChan = make(chan *SendGiftMsg, SEND_WORKER) - for i := 0; i < 4; i++ { + for i := 0; i < 1; i++ { go func() { deal() }() @@ -107,7 +107,7 @@ func main() { } func check() { - tick := time.NewTicker(time.Second * 3) + tick := time.NewTicker(time.Second * 30) defer tick.Stop() for { select { @@ -148,7 +148,7 @@ func deal() { } sendGiftChan <- msg } - time.Sleep(time.Second) // 控制全服banner速率 + time.Sleep(time.Second * 5) // 控制全服banner速率 } }