增加地图广播限制速率
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
package maps
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/logic/service/common"
|
||||
"blazing/logic/service/player"
|
||||
"blazing/logic/service/space"
|
||||
|
||||
"blazing/modules/blazing/model"
|
||||
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"golang.org/x/time/rate"
|
||||
)
|
||||
|
||||
type WalkInInfo struct {
|
||||
@@ -22,6 +26,10 @@ type WalkInInfo struct {
|
||||
|
||||
func (t *WalkInInfo) Broadcast(mapid uint32, o WalkOutInfo) {
|
||||
|
||||
r := cool.Limiter.Get("Broadcast"+gconv.String(mapid), rate.Limit(10), 5)
|
||||
if !r.Allow() {
|
||||
return
|
||||
}
|
||||
space.GetSpace(mapid).User.IterCb(func(playerID uint32, player common.PlayerI) {
|
||||
t.Head.Result = 0
|
||||
tt := t.Head.Pack(&o)
|
||||
|
||||
Reference in New Issue
Block a user