From a702686986ac1a79f90551b959dd1a35386a0c14 Mon Sep 17 00:00:00 2001 From: "Kim, JinSan" Date: Tue, 15 Dec 2020 13:34:49 +0900 Subject: [PATCH 1/2] chore: add `idle-timeout` to rest server and bump up tendermint --- client/flags/flags.go | 2 ++ client/lcd/root.go | 4 +++- go.mod | 5 ++++- go.sum | 5 ++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/client/flags/flags.go b/client/flags/flags.go index 746b512b06..b2af697dad 100644 --- a/client/flags/flags.go +++ b/client/flags/flags.go @@ -62,6 +62,7 @@ const ( FlagMaxOpenConnections = "max-open" FlagRPCReadTimeout = "read-timeout" FlagRPCWriteTimeout = "write-timeout" + FlagRPCIdleTimeout = "idle-timeout" FlagOutputDocument = "output-document" // inspired by wget -O FlagSkipConfirmation = "yes" FlagProve = "prove" @@ -142,6 +143,7 @@ func RegisterRestServerFlags(cmd *cobra.Command) *cobra.Command { cmd.Flags().Uint(FlagMaxOpenConnections, 1000, "The number of maximum open connections") cmd.Flags().Uint(FlagRPCReadTimeout, 10, "The RPC read timeout (in seconds)") cmd.Flags().Uint(FlagRPCWriteTimeout, 10, "The RPC write timeout (in seconds)") + cmd.Flags().Uint(FlagRPCIdleTimeout, 60, "The RPC idle timeout (in seconds)") cmd.Flags().Bool(FlagUnsafeCORS, false, "Allows CORS requests from all domains. For development purposes only, use it at your own risk.") return cmd diff --git a/client/lcd/root.go b/client/lcd/root.go index 6b5abf87bc..5d4f407958 100644 --- a/client/lcd/root.go +++ b/client/lcd/root.go @@ -47,7 +47,7 @@ func NewRestServer(cdc *codec.Codec) *RestServer { } // Start starts the rest server -func (rs *RestServer) Start(listenAddr string, maxOpen int, readTimeout, writeTimeout uint, cors bool) (err error) { +func (rs *RestServer) Start(listenAddr string, maxOpen int, readTimeout, writeTimeout, idleTimeout uint, cors bool) (err error) { server.TrapSignal(func() { err := rs.listener.Close() rs.log.Error("error closing listener", "err", err) @@ -57,6 +57,7 @@ func (rs *RestServer) Start(listenAddr string, maxOpen int, readTimeout, writeTi cfg.MaxOpenConnections = maxOpen cfg.ReadTimeout = time.Duration(readTimeout) * time.Second cfg.WriteTimeout = time.Duration(writeTimeout) * time.Second + cfg.IdleTimeout = time.Duration(idleTimeout) * time.Second rs.listener, err = tmrpcserver.Listen(listenAddr, cfg) if err != nil { @@ -97,6 +98,7 @@ func ServeCommand(cdc *codec.Codec, registerRoutesFn func(*RestServer)) *cobra.C viper.GetInt(flags.FlagMaxOpenConnections), uint(viper.GetInt(flags.FlagRPCReadTimeout)), uint(viper.GetInt(flags.FlagRPCWriteTimeout)), + uint(viper.GetInt(flags.FlagRPCIdleTimeout)), viper.GetBool(flags.FlagUnsafeCORS), ) diff --git a/go.mod b/go.mod index 10e3254923..b2bed6a710 100644 --- a/go.mod +++ b/go.mod @@ -42,4 +42,7 @@ require ( gopkg.in/yaml.v2 v2.3.0 ) -replace github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 +replace ( + github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 + github.com/tendermint/tendermint => github.com/line/tendermint v0.33.10-0.20201215041755-c81005d8468b +) diff --git a/go.sum b/go.sum index 6d9c756afc..bbb8d6b513 100644 --- a/go.sum +++ b/go.sum @@ -263,6 +263,8 @@ github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOS github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/line/tendermint v0.33.10-0.20201215041755-c81005d8468b h1:iIGlUondhI/bf/05Q1XZ2FDgnP3TiktfGURNtfJivsI= +github.com/line/tendermint v0.33.10-0.20201215041755-c81005d8468b/go.mod h1:0yUs9eIuuDq07nQql9BmI30FtYGcEC60Tu5JzB5IezM= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= @@ -443,9 +445,6 @@ github.com/tendermint/go-amino v0.15.1 h1:D2uk35eT4iTsvJd9jWIetzthE5C0/k2QmMFkCN github.com/tendermint/go-amino v0.15.1/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/iavl v0.14.3 h1:tuiUAqJdA3OOyPU/9P3pMYnAcd+OL7BUdzNiE3ytUwQ= github.com/tendermint/iavl v0.14.3/go.mod h1:vHLYxU/zuxBmxxr1v+5Vnd/JzcIsyK17n9P9RDubPVU= -github.com/tendermint/tendermint v0.33.5/go.mod h1:0yUs9eIuuDq07nQql9BmI30FtYGcEC60Tu5JzB5IezM= -github.com/tendermint/tendermint v0.33.9 h1:rRKIfu5qAXX5f9bwX1oUXSZz/ALFJjDuivhkbGUQxiU= -github.com/tendermint/tendermint v0.33.9/go.mod h1:0yUs9eIuuDq07nQql9BmI30FtYGcEC60Tu5JzB5IezM= github.com/tendermint/tm-db v0.5.1 h1:H9HDq8UEA7Eeg13kdYckkgwwkQLBnJGgX4PgLJRhieY= github.com/tendermint/tm-db v0.5.1/go.mod h1:g92zWjHpCYlEvQXvy9M168Su8V1IBEeawpXVVBaK4f4= github.com/tendermint/tm-db v0.5.2 h1:QG3IxQZBubWlr7kGQcYIavyTNmZRO+r//nENxoq0g34= From 508a63642ab1a3b37bb4066235485592a1f63972 Mon Sep 17 00:00:00 2001 From: "Kim, JinSan" Date: Tue, 15 Dec 2020 15:34:38 +0900 Subject: [PATCH 2/2] chore: revise .circleci/config.yml --- .circleci/config.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 20367b0dcf..e1d0cfcc02 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,10 +40,16 @@ jobs: - go-mod-v2-{{ checksum "go.sum" }} - run: name: Cache go modules - command: make go-mod-cache + command: | + go env -w GOPRIVATE=github.com/line/* + git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/" + make go-mod-cache - run: name: Build - command: make build + command: | + go env -w GOPRIVATE=github.com/line/* + git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/" + make build - run: name: Git garbage collection command: git gc @@ -106,6 +112,8 @@ jobs: command: | export VERSION="$(git describe --tags --long | sed 's/v\(.*\)/\1/')" export GO111MODULE=on + go env -w GOPRIVATE=github.com/line/* + git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/" mkdir -p /tmp/logs /tmp/workspace/profiles for pkg in $(go list ./... | grep -v '/simulation' | circleci tests split); do id=$(echo "$pkg" | sed 's|[/.]|_|g') @@ -134,6 +142,8 @@ jobs: - run: name: lint command: | + go env -w GOPRIVATE=github.com/line/* + git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/" go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.27 make lint