淇敼锛?. 鏂板浜嗛攣鏈哄埗浠ラ槻姝㈠苟鍙戣闂啿绐侊紱2. 淇敼浜嗕竴浜涘彉閲忓悕浠ユ彁楂樹唬鐮佸彲璇绘€э紱 3. 淇浜嗕竴涓彲鑳藉鑷寸紦鍐插尯婧㈠嚭鐨?bug锛屽皢缂撳啿鍖哄ぇ灏忚缃负 4096锛?. 瀵逛唬鐮佽繘琛屼簡涓€浜涘叾浠栫殑灏忔敼杩涘拰浼樺寲銆?

git-svn-id: svn://47.119.165.148/zhub@121 e63fbceb-bcc3-4977-ac22-735b83d8d0f4
This commit is contained in:
lxy
2021-05-03 14:35:44 +00:00
parent ee885e198a
commit b38fdfa058
12 changed files with 356 additions and 29 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"fmt"
"log"
"strconv"
"testing"
@@ -108,12 +109,13 @@ func TestTimer(t *testing.T) {
}
func TestSendCmd(t *testing.T) {
client, err := cli.Create(addr, "")
client, err := cli.Create(addr, "group-admin")
if err != nil {
log.Println(err)
}
client.Cmd("reload-timer")
//client.Cmd("reload-timer")
client.Cmd("shutdown")
}
func TestPublish(t *testing.T) {
@@ -127,3 +129,29 @@ func TestPublish(t *testing.T) {
time.Sleep(time.Second)
}
func TestLock(t *testing.T) {
client, _ := cli.Create(addr, "xx")
client.Subscribe("lock", func(v string) {
})
var fun = func(x string) {
log.Println("lock", time.Now().UnixNano()/1e6)
lock := client.Lock("a", 30)
defer client.Unlock(lock)
//client.Lock("a", 5)
for i := 0; i < 5; i++ {
time.Sleep(time.Second * 1)
fmt.Println(x + ":" + strconv.Itoa(i+1))
}
}
go fun("x")
go fun("y")
go fun("z")
time.Sleep(time.Second * 30 * 10)
}