修改:delay 代词拼写错误

git-svn-id: svn://47.119.165.148/zhub@96 e63fbceb-bcc3-4977-ac22-735b83d8d0f4
This commit is contained in:
lxy
2021-02-01 11:37:51 +00:00
parent 8e1074e461
commit 8fd6eea28e
4 changed files with 12 additions and 12 deletions

View File

@@ -149,8 +149,8 @@ func (c *Client) Broadcast(topic string, message string) error {
return c.send("broadcast", topic, message)
}
func (c *Client) Daly(topic string, message string, daly int) error {
return c.send("daly", topic, message, strconv.Itoa(daly))
func (c *Client) Delay(topic string, message string, delay int) error {
return c.send("delay", topic, message, strconv.Itoa(delay))
}
/*func (c *Client) Timer(topic string, expr string, fun func()) {
@@ -264,9 +264,9 @@ func (c *Client) receive() {
c.timerReceive <- vs
continue
}
/*if len(vs) == 2 && strings.EqualFold(vs[0], "daly") {
c.dalyFun[vs[1]]()
delete(c.dalyFun, vs[1])
/*if len(vs) == 2 && strings.EqualFold(vs[0], "delay") {
c.delayFun[vs[1]]()
delete(c.delayFun, vs[1])
continue
}*/

View File

@@ -36,7 +36,7 @@ func TestCli(t *testing.T) {
client.Subscribe("a", func(v string) {
log.Println("收到主题 a 消息 " + v)
})
client.Daly("a", "x", 3000)
client.Delay("a", "x", 3000)
time.Sleep(time.Hour * 3)
}

View File

@@ -38,7 +38,7 @@ func msgAccept(v Message) {
return false
}
arr := []string{"subscribe", "unsubscribe", "daly", "groupid"}
arr := []string{"subscribe", "unsubscribe", "delay", "groupid"}
if startWithAny(rcmd[0], arr...) {
rcmd = strings.Split(rcmd[0], " ")
} else {
@@ -69,8 +69,8 @@ func msgAccept(v Message) {
}
case "broadcast":
zsub.broadcast(rcmd[1], rcmd[2])
case "daly":
zsub.daly(rcmd, c)
case "delay":
zsub.delay(rcmd, c)
case "timer":
zsub.timer(rcmd, c)
case "cmd":
@@ -87,8 +87,8 @@ func msgAccept(v Message) {
}
}
// daly topic value 100 -> publish topic value
func (s *ZSub) daly(rcmd []string, c *ZConn) {
// delay topic value 100 -> publish topic value
func (s *ZSub) delay(rcmd []string, c *ZConn) {
s.Lock()
defer s.Unlock()
if len(rcmd) != 4 {

View File

@@ -149,7 +149,7 @@ func (s *ZSub) close(c *ZConn) {
s.unsubscribe(c, topic)
}
// daly
// delay
// timer conn close
s.Lock()