Skip to content

Commit 865c488

Browse files
committed
Clean up unused config
1 parent 59a9c6a commit 865c488

File tree

3 files changed

+13
-40
lines changed

3 files changed

+13
-40
lines changed

cmd/root.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func init() {
6565
rootCmd.PersistentFlags().Int("poller-s3-maxConcurrentDownloads", 3, "Max concurrent downloads for poller archive source")
6666
rootCmd.PersistentFlags().Bool("committer-enabled", true, "Toggle committer")
6767
rootCmd.PersistentFlags().Int("committer-blocks-per-commit", 10, "How many blocks to commit each interval")
68-
rootCmd.PersistentFlags().Int("committer-interval", 1000, "How often to commit blocks in milliseconds")
6968
rootCmd.PersistentFlags().Int("committer-from-block", 0, "From which block to start committing")
7069
rootCmd.PersistentFlags().Int("committer-to-block", 0, "To which block to commit")
7170
rootCmd.PersistentFlags().Bool("reorgHandler-enabled", true, "Toggle reorg handler")
@@ -191,8 +190,6 @@ func init() {
191190
rootCmd.PersistentFlags().String("publisher-events-topicName", "", "Kafka topic name for events")
192191
rootCmd.PersistentFlags().String("publisher-events-addressFilter", "", "Filter events by address")
193192
rootCmd.PersistentFlags().String("publisher-events-topic0Filter", "", "Filter events by topic0")
194-
rootCmd.PersistentFlags().Int("workMode-checkIntervalMinutes", 10, "How often to check work mode in minutes")
195-
rootCmd.PersistentFlags().Int64("workMode-liveModeThreshold", 500, "How many blocks the indexer can be behind before switching to live mode")
196193
rootCmd.PersistentFlags().String("validation-mode", "strict", "Validation mode. Strict will validate logsBloom and transactionsRoot. Minimal will validate transaction count and logs existence.")
197194
rootCmd.PersistentFlags().String("migrator-destination-type", "auto", "Storage type for migrator destination (auto, clickhouse, postgres, kafka, badger, pebble, s3)")
198195
rootCmd.PersistentFlags().String("migrator-destination-clickhouse-host", "", "Clickhouse host for migrator destination")
@@ -263,7 +260,6 @@ func init() {
263260
viper.BindPFlag("poller.s3.maxConcurrentDownloads", rootCmd.PersistentFlags().Lookup("poller-s3-maxConcurrentDownloads"))
264261
viper.BindPFlag("committer.enabled", rootCmd.PersistentFlags().Lookup("committer-enabled"))
265262
viper.BindPFlag("committer.blocksPerCommit", rootCmd.PersistentFlags().Lookup("committer-blocks-per-commit"))
266-
viper.BindPFlag("committer.interval", rootCmd.PersistentFlags().Lookup("committer-interval"))
267263
viper.BindPFlag("committer.fromBlock", rootCmd.PersistentFlags().Lookup("committer-from-block"))
268264
viper.BindPFlag("committer.toBlock", rootCmd.PersistentFlags().Lookup("committer-to-block"))
269265
viper.BindPFlag("reorgHandler.enabled", rootCmd.PersistentFlags().Lookup("reorgHandler-enabled"))
@@ -389,8 +385,6 @@ func init() {
389385
viper.BindPFlag("publisher.events.topicName", rootCmd.PersistentFlags().Lookup("publisher-events-topicName"))
390386
viper.BindPFlag("publisher.events.addressFilter", rootCmd.PersistentFlags().Lookup("publisher-events-addressFilter"))
391387
viper.BindPFlag("publisher.events.topic0Filter", rootCmd.PersistentFlags().Lookup("publisher-events-topic0Filter"))
392-
viper.BindPFlag("workMode.checkIntervalMinutes", rootCmd.PersistentFlags().Lookup("workMode-checkIntervalMinutes"))
393-
viper.BindPFlag("workMode.liveModeThreshold", rootCmd.PersistentFlags().Lookup("workMode-liveModeThreshold"))
394388
viper.BindPFlag("validation.mode", rootCmd.PersistentFlags().Lookup("validation-mode"))
395389
// Migrator viper bindings
396390
viper.BindPFlag("migrator.destination.type", rootCmd.PersistentFlags().Lookup("migrator-destination-type"))

configs/config.go

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ type PollerConfig struct {
2424

2525
type CommitterConfig struct {
2626
Enabled bool `mapstructure:"enabled"`
27-
Interval int `mapstructure:"interval"`
2827
BlocksPerCommit int `mapstructure:"blocksPerCommit"`
2928
FromBlock int `mapstructure:"fromBlock"`
3029
ToBlock int `mapstructure:"toBlock"`
@@ -38,12 +37,6 @@ type ReorgHandlerConfig struct {
3837
ForceFromBlock bool `mapstructure:"forceFromBlock"`
3938
}
4039

41-
type FailureRecovererConfig struct {
42-
Enabled bool `mapstructure:"enabled"`
43-
Interval int `mapstructure:"interval"`
44-
BlocksPerRun int `mapstructure:"blocksPerRun"`
45-
}
46-
4740
type StorageConfig struct {
4841
Orchestrator StorageOrchestratorConfig `mapstructure:"orchestrator"`
4942
Staging StorageStagingConfig `mapstructure:"staging"`
@@ -254,11 +247,6 @@ type S3SourceConfig struct {
254247
MaxConcurrentDownloads int `mapstructure:"maxConcurrentDownloads"`
255248
}
256249

257-
type WorkModeConfig struct {
258-
CheckIntervalMinutes int `mapstructure:"checkIntervalMinutes"`
259-
LiveModeThreshold int64 `mapstructure:"liveModeThreshold"`
260-
}
261-
262250
type ValidationConfig struct {
263251
Mode string `mapstructure:"mode"` // "disabled", "minimal", "strict"
264252
}
@@ -272,18 +260,16 @@ type MigratorConfig struct {
272260
}
273261

274262
type Config struct {
275-
RPC RPCConfig `mapstructure:"rpc"`
276-
Log LogConfig `mapstructure:"log"`
277-
Poller PollerConfig `mapstructure:"poller"`
278-
Committer CommitterConfig `mapstructure:"committer"`
279-
FailureRecoverer FailureRecovererConfig `mapstructure:"failureRecoverer"`
280-
ReorgHandler ReorgHandlerConfig `mapstructure:"reorgHandler"`
281-
Storage StorageConfig `mapstructure:"storage"`
282-
API APIConfig `mapstructure:"api"`
283-
Publisher PublisherConfig `mapstructure:"publisher"`
284-
WorkMode WorkModeConfig `mapstructure:"workMode"`
285-
Validation ValidationConfig `mapstructure:"validation"`
286-
Migrator MigratorConfig `mapstructure:"migrator"`
263+
RPC RPCConfig `mapstructure:"rpc"`
264+
Log LogConfig `mapstructure:"log"`
265+
Poller PollerConfig `mapstructure:"poller"`
266+
Committer CommitterConfig `mapstructure:"committer"`
267+
ReorgHandler ReorgHandlerConfig `mapstructure:"reorgHandler"`
268+
Storage StorageConfig `mapstructure:"storage"`
269+
API APIConfig `mapstructure:"api"`
270+
Publisher PublisherConfig `mapstructure:"publisher"`
271+
Validation ValidationConfig `mapstructure:"validation"`
272+
Migrator MigratorConfig `mapstructure:"migrator"`
287273
}
288274

289275
var Cfg Config

internal/orchestrator/work_mode_monitor.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"time"
88

99
"github.com/rs/zerolog/log"
10-
config "github.com/thirdweb-dev/indexer/configs"
1110
"github.com/thirdweb-dev/indexer/internal/metrics"
1211
"github.com/thirdweb-dev/indexer/internal/rpc"
1312
"github.com/thirdweb-dev/indexer/internal/storage"
@@ -33,22 +32,16 @@ type WorkModeMonitor struct {
3332
}
3433

3534
func NewWorkModeMonitor(rpc rpc.IRPCClient, storage storage.IStorage) *WorkModeMonitor {
36-
checkInterval := config.Cfg.WorkMode.CheckIntervalMinutes
37-
if checkInterval < 1 {
38-
checkInterval = DEFAULT_WORK_MODE_CHECK_INTERVAL
39-
}
40-
liveModeThreshold := config.Cfg.WorkMode.LiveModeThreshold
41-
if liveModeThreshold < 1 {
42-
liveModeThreshold = DEFAULT_LIVE_MODE_THRESHOLD
43-
}
35+
checkInterval := DEFAULT_WORK_MODE_CHECK_INTERVAL
36+
liveModeThreshold := DEFAULT_LIVE_MODE_THRESHOLD
4437
log.Info().Msgf("Work mode monitor initialized with check interval %d and live mode threshold %d", checkInterval, liveModeThreshold)
4538
return &WorkModeMonitor{
4639
rpc: rpc,
4740
storage: storage,
4841
workModeChannels: make(map[chan WorkMode]struct{}),
4942
currentMode: "",
5043
checkInterval: time.Duration(checkInterval) * time.Minute,
51-
liveModeThreshold: big.NewInt(liveModeThreshold),
44+
liveModeThreshold: big.NewInt(int64(liveModeThreshold)),
5245
}
5346
}
5447

0 commit comments

Comments
 (0)