Compare commits

...
1 Commits
Author SHA1 Message Date
whyrusleeping 88107a49a5 add flags to control gateway lookback parameters 2021-06-25 22:29:34 +00:00
+16 -1
View File
@@ -8,6 +8,7 @@ import (
"contrib.go.opencensus.io/exporter/prometheus"
"github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/go-state-types/abi"
promclient "github.com/prometheus/client_golang/prometheus"
"go.opencensus.io/tag"
@@ -70,6 +71,16 @@ var runCmd = &cli.Command{
Name: "api-max-req-size",
Usage: "maximum API request size accepted by the JSON RPC server",
},
&cli.DurationFlag{
Name: "api-max-lookback",
Usage: "maximum duration allowable for tipset lookbacks",
Value: LookbackCap,
},
&cli.Int64Flag{
Name: "api-wait-lookback-limit",
Usage: "maximum number of blocks to search back through for message inclusion",
Value: int64(StateWaitLookbackLimit),
},
},
Action: func(cctx *cli.Context) error {
log.Info("Starting lotus gateway")
@@ -107,7 +118,11 @@ var runCmd = &cli.Command{
mux.Handle(path, rpcServer)
}
ma := metrics.MetricedGatewayAPI(NewGatewayAPI(api))
lookbackCap := cctx.Duration("api-max-lookback")
waitLookback := abi.ChainEpoch(cctx.Int64("api-wait-lookback-limit"))
ma := metrics.MetricedGatewayAPI(newGatewayAPI(api, lookbackCap, waitLookback))
serveRpc("/rpc/v1", ma)
serveRpc("/rpc/v0", lapi.Wrap(new(v1api.FullNodeStruct), new(v0api.WrapperV1Full), ma))