feat 排队
This commit is contained in:
29
app/login_queue.go
Normal file
29
app/login_queue.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"gateway/internal/global"
|
||||
"gateway/internal/handler/ws_handler/login"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// ModuleLoginQueue 登录队列模块
|
||||
type ModuleLoginQueue struct {
|
||||
login *login.Login
|
||||
queueUp *login.QueueUp
|
||||
}
|
||||
|
||||
func (m *ModuleLoginQueue) init() error {
|
||||
m.login = login.NewLoginQueue(global.MaxQueueUpSize)
|
||||
m.queueUp = login.NewQueueUp(global.MaxQueueUpSize)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ModuleLoginQueue) start() error {
|
||||
m.login.Start(runtime.NumCPU())
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ModuleLoginQueue) stop() error {
|
||||
m.login.Stop()
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user