Skip to content

Commit

Permalink
statistics chart exporter only mainnet (BIDS-601)
Browse files Browse the repository at this point in the history
JIRA: (BIDS-601)
  • Loading branch information
Stefan committed Dec 6, 2022
1 parent fe5e829 commit 0c59f5f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions cmd/statistics/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ func main() {
poolsDisabledFlag: *poolsDisabledFlag,
}

if *statisticsChartToggle && utils.Config.Chain.Config.DepositChainID != 1 {
logrus.Infof("Execution charts are currently only available for mainnet")
}

logrus.Printf("version: %v, config file path: %v", version.Version, *configPath)
cfg := &types.Config{}
err := utils.ReadConfig(cfg, *configPath)
Expand Down Expand Up @@ -121,7 +125,7 @@ func main() {
}
}

if *statisticsChartToggle {
if *statisticsChartToggle && utils.Config.Chain.Config.DepositChainID == 1 {
logrus.Infof("exporting chart series for days %v-%v", firstDay, lastDay)
for d := firstDay; d <= lastDay; d++ {
_, err = db.WriterDb.Exec("delete from chart_series_status where day = $1", d)
Expand Down Expand Up @@ -151,7 +155,7 @@ func main() {
}
}

if *statisticsChartToggle {
if *statisticsChartToggle && utils.Config.Chain.Config.DepositChainID == 1 {
_, err = db.WriterDb.Exec("delete from chart_series_status where day = $1", *statisticsDayToExport)
if err != nil {
logrus.Fatalf("error resetting status for chart series status for day %v: %v", *statisticsDayToExport, err)
Expand Down Expand Up @@ -230,12 +234,14 @@ func statisticsLoop() {
if lastExportedDayChart != 0 {
lastExportedDayChart++
}
logrus.Infof("Chart statistics: latest epoch is %v, previous day is %v, last exported day is %v", latestEpoch, previousDay, lastExportedDayChart)
if lastExportedDayChart <= previousDay || lastExportedDayChart == 0 {
for day := lastExportedDayChart; day <= previousDay; day++ {
err = db.WriteChartSeriesForDay(int64(day))
if err != nil {
logrus.Errorf("error exporting chart series from day %v: %v", day, err)
if utils.Config.Chain.Config.DepositChainID == 1 {
logrus.Infof("Chart statistics: latest epoch is %v, previous day is %v, last exported day is %v", latestEpoch, previousDay, lastExportedDayChart)
if lastExportedDayChart <= previousDay || lastExportedDayChart == 0 {
for day := lastExportedDayChart; day <= previousDay; day++ {
err = db.WriteChartSeriesForDay(int64(day))
if err != nil {
logrus.Errorf("error exporting chart series from day %v: %v", day, err)
}
}
}
}
Expand Down

0 comments on commit 0c59f5f

Please sign in to comment.