淇敼锛歵opic & message chan overload check

git-svn-id: svn://47.119.165.148/zhub@129 e63fbceb-bcc3-4977-ac22-735b83d8d0f4
This commit is contained in:
lxy
2021-09-25 17:38:31 +00:00
parent b5e55c9869
commit df84efffce
2 changed files with 20 additions and 3 deletions

View File

@@ -1,6 +1,10 @@
package zsub
import "sync"
import (
"fmt"
"log"
"sync"
)
type ZTopic struct { //ZTopic
sync.Mutex
@@ -19,7 +23,12 @@ func (t *ZTopic) init() {
break
}
for _, group := range t.groups {
for name, group := range t.groups {
// zgroup chan overload check
if len(group.chMsg) == cap(group.chMsg) {
log.Println(fmt.Sprintf("zgroup no cap: [%s.%s %s]", name, t.topic, msg))
continue
}
group.chMsg <- msg
}
}