Skip to content

Commit

Permalink
Update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Aug 21, 2023
1 parent 34b7497 commit 1591b46
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
3 changes: 2 additions & 1 deletion build/dipdup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ metadata:

filler:
datasource: ${DATASOURCE:-node}
rps: ${DATASOURCE_RPS:-3}
workers_count: 3
max_attempts: ${MAX_RETRY_COUNT:-5}
delay: 10
Expand Down Expand Up @@ -135,7 +134,9 @@ datasources:
url: ${SEQUENCER_URL:-https://alpha-mainnet.starknet.io/feeder_gateway}
kind: starknet_sequencer
timeout: 30
rps: ${DATASOURCE_RPS:-3}
node:
url: ${NODE_URL}
kind: starknet_node_rpc
timeout: 30
rps: ${DATASOURCE_RPS:-3}
1 change: 0 additions & 1 deletion cmd/metadata/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ type IPFS struct {
// FillerConfig -
type FillerConfig struct {
Datasource string `yaml:"datasource" validate:"required,oneof=sequencer node"`
Rps int `yaml:"rps" validate:"omitempty,min=1"`
WorkersCount int `yaml:"workers_count" validate:"required,min=1"`
MaxAttempts int `yaml:"max_attempts" validate:"omitempty,min=1"`
Delay int `yaml:"delay" validate:"omitempty,min=1"`
Expand Down
8 changes: 4 additions & 4 deletions cmd/metadata/filler.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ var (
multicallEntrypoint = encoding.GetSelectorWithPrefixFromName("execute_calls")
)

func newCaller(name string, datasources map[string]config.DataSource, rps int) (caller.Caller, error) {
func newCaller(name string, datasources map[string]config.DataSource) (caller.Caller, error) {
if cfg, ok := datasources[name]; ok {
switch name {
case "sequencer":
return caller.NewSequencerCaller(cfg, rps), nil
return caller.NewSequencerCaller(cfg), nil
case "node":
return caller.NewNodeRpcCaller(cfg, rps), nil
return caller.NewNodeRpcCaller(cfg), nil
}
}
return nil, errors.Errorf("unknown caller type: %s", name)
Expand Down Expand Up @@ -92,7 +92,7 @@ func NewFiller(cfg FillerConfig, datasources map[string]config.DataSource, tm st
delay = cfg.Delay
}

caller, err := newCaller(cfg.Datasource, datasources, cfg.Rps)
caller, err := newCaller(cfg.Datasource, datasources)
if err != nil {
return Filler{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/dipdup-io/starknet-go-api v0.0.0-20230818110656-b2736a55da83
github.com/dipdup-io/starknet-indexer v0.0.0-20230819141739-8eb8f315fb6b
github.com/dipdup-io/workerpool v0.0.3
github.com/dipdup-net/go-lib v0.3.0
github.com/dipdup-net/go-lib v0.3.3
github.com/dipdup-net/indexer-sdk v0.0.0-20230819120445-392cbc4cfb65
github.com/go-testfixtures/testfixtures/v3 v3.9.0
github.com/goccy/go-json v0.10.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ github.com/dipdup-io/starknet-indexer v0.0.0-20230819141739-8eb8f315fb6b h1:hzY7
github.com/dipdup-io/starknet-indexer v0.0.0-20230819141739-8eb8f315fb6b/go.mod h1:WhfP7FE8qNm4azJ8XGXC9cQhrklGpxEW5OzgDO5kmLI=
github.com/dipdup-io/workerpool v0.0.3 h1:+cnO0/J0e4UiJ0EBEDpvuhriSDVHlsPminGRU2Il+ZI=
github.com/dipdup-io/workerpool v0.0.3/go.mod h1:m6YMqx7M+fORTyabHD/auKymBRpbDax0t1aPZ1i7GZA=
github.com/dipdup-net/go-lib v0.3.0 h1:56OImCLIHyLL4Da7UI5H2xyTP65i2FUXSO6Gyxll460=
github.com/dipdup-net/go-lib v0.3.0/go.mod h1:oBDOSsM/F8fEnmuDnaJ6QA/cHH4lne49ASbsh8WXDe4=
github.com/dipdup-net/go-lib v0.3.3 h1:vTUI+sT4L+x+eiMf712Cg8EtlqUCMiN6M3vcNaPlCw8=
github.com/dipdup-net/go-lib v0.3.3/go.mod h1:oBDOSsM/F8fEnmuDnaJ6QA/cHH4lne49ASbsh8WXDe4=
github.com/dipdup-net/indexer-sdk v0.0.0-20230819120445-392cbc4cfb65 h1:jZ53iH1UhoBTtIj4pRUPz826EFIwr7KYUR7EkwokwPM=
github.com/dipdup-net/indexer-sdk v0.0.0-20230819120445-392cbc4cfb65/go.mod h1:sZEbnuguFw8kxgD3iNLLHDq1DUDrXI6KcghNMcmNCS4=
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
Expand Down
6 changes: 3 additions & 3 deletions internal/caller/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ type NodeRpcCaller struct {
}

// NewNodeRpcCaller -
func NewNodeRpcCaller(cfg config.DataSource, rps int) *NodeRpcCaller {
func NewNodeRpcCaller(cfg config.DataSource) *NodeRpcCaller {
var (
timeout = time.Second * 10
opts = make([]rpc.ApiOption, 0)
)

if rps > 0 {
opts = append(opts, rpc.WithRateLimit(rps))
if cfg.RequestsPerSecond > 0 {
opts = append(opts, rpc.WithRateLimit(cfg.RequestsPerSecond))
}

if cfg.Timeout > 0 {
Expand Down
6 changes: 3 additions & 3 deletions internal/caller/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ type SequencerCaller struct {
}

// NewSequencerCaller -
func NewSequencerCaller(cfg config.DataSource, rps int) *SequencerCaller {
func NewSequencerCaller(cfg config.DataSource) *SequencerCaller {
var (
timeout = time.Second * 10
opts = make([]sequencer.ApiOption, 0)
)

if rps > 0 {
opts = append(opts, sequencer.WithRateLimit(rps))
if cfg.RequestsPerSecond > 0 {
opts = append(opts, sequencer.WithRateLimit(cfg.RequestsPerSecond))
}

if cfg.Timeout > 0 {
Expand Down

0 comments on commit 1591b46

Please sign in to comment.