From 28aab81cc5b883a8d2f66926194c5be31a8f6a22 Mon Sep 17 00:00:00 2001 From: CMGS Date: Fri, 4 Sep 2020 11:21:58 +0800 Subject: [PATCH] avoid get node info blocking (#247) --- .github/workflows/goreleaser.yml | 2 ++ rpc/transform.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 846a78bdb..ea57737d9 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -11,6 +11,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Set up environment variables run: | diff --git a/rpc/transform.go b/rpc/transform.go index abc65a82c..c44321b31 100644 --- a/rpc/transform.go +++ b/rpc/transform.go @@ -51,6 +51,8 @@ func toRPCNetwork(n *enginetypes.Network) *pb.Network { func toRPCNode(ctx context.Context, n *types.Node) *pb.Node { var nodeInfo string + ctx, cancel := context.WithTimeout(ctx, time.Second) + defer cancel() if info, err := n.Info(ctx); err == nil { bytes, _ := json.Marshal(info) nodeInfo = string(bytes)