From a09747afcca12a674c0138ae777b6166330fbdec Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期四, 14 一月 2021 18:54:35 +0800 Subject: [PATCH] Request和RequestTopic暴露超时时间 --- requestTopic.go | 2 +- micronode.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/micronode.go b/micronode.go index 7a04fba..945cdc4 100644 --- a/micronode.go +++ b/micronode.go @@ -110,7 +110,7 @@ } } -func (ms *MicroNode) Request(serverId string, request Request) (*Reply,error) { +func (ms *MicroNode) Request(serverId string, request Request, milliSecs int) (*Reply,error) { t := time.Now() ms.printLog("1:", time.Since(t)) @@ -122,7 +122,7 @@ } ms.printLog("2:", time.Since(t)) t = time.Now() - mi,err := ms.handle.Request(serverId, msgR, 5000) + mi,err := ms.handle.Request(serverId, msgR, milliSecs) if mi == nil || err != nil { return nil, err } @@ -142,14 +142,14 @@ return ri, nil } -func (ms *MicroNode) RequestTopic(serverId string, request Request) (*Reply,error) { +func (ms *MicroNode) RequestTopic(serverId string, request Request, milliSecs int) (*Reply,error) { rb, _ := json.Marshal(request) msgR := &MsgInfo{ Topic: request.Path, Body: rb, } - mi, err := ms.handle.Request(serverId, msgR, 5000) + mi, err := ms.handle.Request(serverId, msgR, milliSecs) if err != nil { return nil, err } diff --git a/requestTopic.go b/requestTopic.go index f370bbb..a6abdac 100644 --- a/requestTopic.go +++ b/requestTopic.go @@ -4,5 +4,5 @@ type Transport interface { - RequestTopic(string, Request) (*Reply,error) + RequestTopic(string, Request, int) (*Reply,error) } \ No newline at end of file -- Gitblit v1.8.0