채널이름을 모든 public 함수의 signature를 고려
This commit is contained in:
@ -3,6 +3,7 @@ package rpc
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"repositories.action2quare.com/ayo/gocommon"
|
||||
@ -13,19 +14,18 @@ type testReceiver struct {
|
||||
}
|
||||
|
||||
func (tr *testReceiver) TargetExists(tid primitive.ObjectID) bool {
|
||||
logger.Println(tid.Hex())
|
||||
return tid[0] >= 10
|
||||
}
|
||||
|
||||
func (tr *testReceiver) TestFunc(a string, b string) {
|
||||
logger.Println("TestFunc :", a, b)
|
||||
|
||||
func (tr *testReceiver) TestFunc(a string, b string, c int) {
|
||||
target := primitive.NewObjectID()
|
||||
target[0] = 0
|
||||
if CallOrGo(tr, target, a, b) != ErrCanExecuteHere {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Println(a, b)
|
||||
logger.Println(" ", a, b)
|
||||
}
|
||||
|
||||
func TestRpc(t *testing.T) {
|
||||
@ -34,9 +34,14 @@ func TestRpc(t *testing.T) {
|
||||
myctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
redisClient, _ := gocommon.NewRedisClient("redis://192.168.8.94:6379", 0)
|
||||
Start(myctx, redisClient)
|
||||
go func() {
|
||||
for {
|
||||
tr.TestFunc("aaaa", "bbbb", 333)
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}()
|
||||
|
||||
tr.TestFunc("aaa", "bb")
|
||||
Start(myctx, redisClient)
|
||||
<-myctx.Done()
|
||||
cancel()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user