This commit is contained in:
i-norden 2021-10-25 14:54:55 -05:00
parent f679082c3b
commit 8571f35031
3 changed files with 6 additions and 7 deletions

View File

@ -107,8 +107,8 @@ func setupPreRunRanges() []sd.RangeRequest {
}
preRunParams.WatchedStorageSlots = keys
var rawRanges []blockRange
blockRanges := make([]sd.RangeRequest, len(rawRanges))
viper.UnmarshalKey("prerun.ranges", &rawRanges)
blockRanges := make([]sd.RangeRequest, len(rawRanges))
for i, rawRange := range rawRanges {
blockRanges[i] = sd.RangeRequest{
Start: rawRange[0],

View File

@ -29,8 +29,7 @@ const statsSubsystem = "stats"
var (
metrics bool
queuedRanges prometheus.Counter
queuedRanges prometheus.Gauge
lastLoadedHeight prometheus.Gauge
lastProcessedHeight prometheus.Gauge
@ -54,12 +53,11 @@ const (
func Init() {
metrics = true
queuedRanges = promauto.NewCounter(prometheus.CounterOpts{
queuedRanges = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: RANGES_QUEUED,
Help: "Number of range requests currently queued",
})
lastLoadedHeight = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: LOADED_HEIGHT,
@ -114,7 +112,7 @@ func IncQueuedRanges() {
// DecQueuedRanges decrements the number of queued range requests
func DecQueuedRanges() {
if metrics {
queuedRanges.Add(-1)
queuedRanges.Dec()
}
}

View File

@ -129,7 +129,7 @@ func (sds *Service) Loop(wg *sync.WaitGroup) error {
select {
case blockRange := <-sds.queue:
prom.DecQueuedRanges()
for j := blockRange.Start; j <= blockRange.Start; j++ {
for j := blockRange.Start; j <= blockRange.Stop; j++ {
if err := sds.WriteStateDiffAt(j, blockRange.Params); err != nil {
logrus.Errorf("service worker %d error writing statediff at height %d in range (%d, %d) : %v", id, j, blockRange.Start, blockRange.Stop, err)
}
@ -143,6 +143,7 @@ func (sds *Service) Loop(wg *sync.WaitGroup) error {
logrus.Infof("service worker %d finished processing statediff height %d in range (%d, %d)", id, j, blockRange.Start, blockRange.Stop)
}
}
logrus.Infof("service worker %d finished processing range (%d, %d)", id, blockRange.Start, blockRange.Stop)
case <-sds.quitChan:
logrus.Infof("closing the statediff service loop worker %d", id)
return