mirror of
https://github.com/fhmq/hmq.git
synced 2026-08-30 14:24:53 +00:00
pool
This commit is contained in:
@@ -8,7 +8,23 @@ import (
|
||||
log "github.com/cihub/seelog"
|
||||
)
|
||||
|
||||
//https://github.com/xiaojiaqi/10billionhongbaos
|
||||
const (
|
||||
MaxUser = 1024 * 1024
|
||||
MessagePoolNum = 1024
|
||||
MessagePoolUser = MaxUser / MessagePoolNum
|
||||
MessagePoolMessageNum = MaxUser / MessagePoolNum * 4
|
||||
)
|
||||
|
||||
var (
|
||||
MSGPool []MessagePool
|
||||
)
|
||||
|
||||
func init() {
|
||||
MSGPool = make([]MessagePool, (MessagePoolNum + 2))
|
||||
for i := 0; i < (MessagePoolNum + 2); i++ {
|
||||
MSGPool[i].Init(MessagePoolUser, MessagePoolMessageNum)
|
||||
}
|
||||
}
|
||||
func main() {
|
||||
broker := broker.NewBroker()
|
||||
broker.StartListening()
|
||||
@@ -16,6 +32,7 @@ func main() {
|
||||
s := waitForSignal()
|
||||
log.Infof("signal got: %v ,broker closed.", s)
|
||||
}
|
||||
|
||||
func waitForSignal() os.Signal {
|
||||
signalChan := make(chan os.Signal, 1)
|
||||
defer close(signalChan)
|
||||
|
||||
Reference in New Issue
Block a user