Skip to content

Commit b410f47

Browse files
authored
refactor stat code (#3)
1 parent 58ab7eb commit b410f47

File tree

5 files changed

+4
-329
lines changed

5 files changed

+4
-329
lines changed

cmd/stat.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package cmd
33
import (
44
"context"
55
"github.com/Conflux-Chain/go-conflux-util/viper"
6-
"github.com/zero-gravity-labs/zerog-storage-scan/stat"
76
"github.com/sirupsen/logrus"
87
"github.com/spf13/cobra"
8+
"github.com/zero-gravity-labs/zerog-storage-scan/stat"
99
"sync"
1010
)
1111

@@ -34,14 +34,8 @@ func startStatService(*cobra.Command, []string) {
3434
ctx, cancel := context.WithCancel(context.Background())
3535
var wg sync.WaitGroup
3636

37-
stTx := stat.MustNewStatTx(&cfg, dataCtx.DB, dataCtx.Eth, startTime)
38-
go stTx.DoStat(ctx, &wg)
3937
stSubmit := stat.MustNewStatSubmit(&cfg, dataCtx.DB, dataCtx.Eth, startTime)
4038
go stSubmit.DoStat(ctx, &wg)
41-
stBasicCost := stat.MustNewStatBasicCost(&cfg, dataCtx.DB, dataCtx.Eth, startTime)
42-
go stBasicCost.DoStat(ctx, &wg)
43-
stUplinkRate := stat.MustNewUplinkRateStat(dataCtx.DB)
44-
go stUplinkRate.DoStat(ctx, &wg)
4539

4640
GracefulShutdown(&wg, cancel)
4741
}

stat/stat_basic_cost.go

Lines changed: 0 additions & 129 deletions
This file was deleted.

stat/stat_submit.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package stat
22

33
import (
4-
"github.com/zero-gravity-labs/zerog-storage-scan/store"
54
"github.com/openweb3/web3go"
65
"github.com/pkg/errors"
6+
"github.com/zero-gravity-labs/zerog-storage-scan/store"
77
"gorm.io/gorm"
88
"time"
99
)
@@ -83,6 +83,7 @@ func (ts *StatSubmit) calculateStat(tr *TimeRange) error {
8383
})
8484
}
8585

86+
// TODO add stat for cost and cost total when refactor db domains
8687
func (ts *StatSubmit) statBasicRange(tr *TimeRange) (*store.SubmitStat, error) {
8788
fileCount, dataSize, err := ts.Db.SubmitStore.Count(tr.start, tr.end)
8889
if err != nil {
@@ -103,6 +104,7 @@ func (ts *StatSubmit) statBasicRange(tr *TimeRange) (*store.SubmitStat, error) {
103104
}, nil
104105
}
105106

107+
// TODO add stat for cost and cost total when refactor db domains
106108
func (ts *StatSubmit) statRange(rangEnd *time.Time, srcStatType, descStatType string, latestStat *store.SubmitStat) (*store.SubmitStat, error) {
107109
rangeStart, err := ts.calStatRangeStart(rangEnd, descStatType)
108110
if err != nil {

stat/stat_tx.go

Lines changed: 0 additions & 129 deletions
This file was deleted.

stat/stat_uplink_rate.go

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)