erigon-pulse/cmd/rpcdaemon/main.go
Alex Sharov 9cf10a8f85
Rpcdaemon: Gracefull shutdown, better grpc stream close (#1196)
* save progress

* GracefulShutdown grpc server, send to server close signal before canceling context

* GracefulShutdown grpc server, send to server close signal before canceling context

* GracefulShutdown json server

* GracefulShutdown json server

* fix lint

* fix lint

* can

* clean

* test

* test

* test

* increase keepalive timeout, increase vegeta timeout, mark server-side errors

* increase keepalive timeout, increase vegeta timeout, mark server-side errors

* hack hugeFreelist

* up streams limit

* up streams limit

* up streams limit

* up streams limit

* up streams limit

* up streams limit

* up streams limit

* up streams limit

* up streams limit

* up streams limit

* up streams limit

* fix_race_condition_on_zstd_build
2020-10-10 07:06:54 +01:00

39 lines
873 B
Go

package main
import (
"os"
"github.com/ledgerwatch/turbo-geth/cmd/rpcdaemon/cli"
"github.com/ledgerwatch/turbo-geth/cmd/rpcdaemon/commands"
"github.com/ledgerwatch/turbo-geth/cmd/utils"
"github.com/ledgerwatch/turbo-geth/log"
"github.com/spf13/cobra"
)
var (
gitCommit string
)
func main() {
cmd, cfg := cli.RootCommand()
cmd.RunE = func(cmd *cobra.Command, args []string) error {
db, backend, err := cli.OpenDB(*cfg)
if err != nil {
log.Error("Could not connect to remoteDb", "error", err)
return nil
}
defer db.Close()
var apiList = commands.APIList(db, backend, *cfg, nil)
return cli.StartRpcServer(cmd.Context(), *cfg, apiList)
}
// Hacky way to get these strings into the commands package
commands.SetGitStrings(gitCommit)
if err := cmd.ExecuteContext(utils.RootContext()); err != nil {
log.Error(err.Error())
os.Exit(1)
}
}