Skip to content

Commit

Permalink
added varibles to config
Browse files Browse the repository at this point in the history
  • Loading branch information
ssd04 committed Apr 30, 2024
1 parent 2066e6a commit 2c71761
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
12 changes: 10 additions & 2 deletions cmd/connector/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@

[DataPool]
# Should be smaller then PruningWindow
MaxDelta = 100
MaxDelta = 50

# Defines the number of block that will be added until a new persister will be created
PruningWindow = 1000

# Defines the number of active persisters to keep open
Expand All @@ -39,11 +41,17 @@
# Defines the first commitable meta block round
# If it is set to 0, it will try to get last rounds info from storage,
# otherwise, it will try to sync from observers
FirstCommitableBlock = 30
FirstCommitableBlock = 0

[Publisher]
# RetryDurationInMiliseconds defines the retry duration for common publisher
# handler when there is an error on publish
RetryDurationInMiliseconds = 1000

[OutportBlocksStorage]
[OutportBlocksStorage.Cache]
Name = "OutportBlocksStorage"
# Cache capacity and size has to be higher than max allowed deltas per shards in total
Capacity = 100
Type = "SizeLRU"
SizeInBytes = 209715200 # 200MB
Expand Down
2 changes: 1 addition & 1 deletion cmd/connector/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var (
dbMode = cli.StringFlag{
Name: "db-mode",
Usage: "Option for specifying db mode. Available options: `full-persister`, `import-db`, `optimized-persister`",
Value: "full-persister",
Value: "optimized-persister",
}

enableGrpcServer = cli.BoolFlag{
Expand Down
6 changes: 6 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type Config struct {
DataPool DataPoolConfig
OutportBlocksStorage StorageConfig
GRPC GRPCConfig
Publisher PublisherConfig
}

// WebSocketConfig holds web sockets config
Expand All @@ -29,6 +30,11 @@ type DataPoolConfig struct {
FirstCommitableBlock uint64
}

// PublisherConfig will map publisher configuration
type PublisherConfig struct {
RetryDurationInMiliseconds uint64
}

// StorageConfig will map the storage unit configuration
type StorageConfig struct {
Cache CacheConfig
Expand Down
3 changes: 1 addition & 2 deletions connector/connectorRunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,11 @@ func (cr *connectorRunner) Run() error {
return fmt.Errorf("cannot create publisher: %w", err)
}

retryDurationInMiliseconds := int64(1000)
publisherHandler, err := process.NewPublisherHandler(
hyperBlockPublisher,
outportBlocksPool,
dataAggregator,
retryDurationInMiliseconds,
cr.config.Publisher.RetryDurationInMiliseconds,
cr.config.DataPool.FirstCommitableBlock,
)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion process/publisherHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewPublisherHandler(
handler HyperBlockPublisher,
outportBlocksPool HyperBlocksPool,
dataAggregator DataAggregator,
retryDurationInMiliseconds int64,
retryDurationInMiliseconds uint64,
firstCommitableBlock uint64,
) (*publisherHandler, error) {
if check.IfNil(handler) {
Expand Down

0 comments on commit 2c71761

Please sign in to comment.