fixes
This commit is contained in:
parent
f679082c3b
commit
8571f35031
@ -107,8 +107,8 @@ func setupPreRunRanges() []sd.RangeRequest {
|
|||||||
}
|
}
|
||||||
preRunParams.WatchedStorageSlots = keys
|
preRunParams.WatchedStorageSlots = keys
|
||||||
var rawRanges []blockRange
|
var rawRanges []blockRange
|
||||||
blockRanges := make([]sd.RangeRequest, len(rawRanges))
|
|
||||||
viper.UnmarshalKey("prerun.ranges", &rawRanges)
|
viper.UnmarshalKey("prerun.ranges", &rawRanges)
|
||||||
|
blockRanges := make([]sd.RangeRequest, len(rawRanges))
|
||||||
for i, rawRange := range rawRanges {
|
for i, rawRange := range rawRanges {
|
||||||
blockRanges[i] = sd.RangeRequest{
|
blockRanges[i] = sd.RangeRequest{
|
||||||
Start: rawRange[0],
|
Start: rawRange[0],
|
||||||
|
@ -29,8 +29,7 @@ const statsSubsystem = "stats"
|
|||||||
var (
|
var (
|
||||||
metrics bool
|
metrics bool
|
||||||
|
|
||||||
queuedRanges prometheus.Counter
|
queuedRanges prometheus.Gauge
|
||||||
|
|
||||||
lastLoadedHeight prometheus.Gauge
|
lastLoadedHeight prometheus.Gauge
|
||||||
lastProcessedHeight prometheus.Gauge
|
lastProcessedHeight prometheus.Gauge
|
||||||
|
|
||||||
@ -54,12 +53,11 @@ const (
|
|||||||
func Init() {
|
func Init() {
|
||||||
metrics = true
|
metrics = true
|
||||||
|
|
||||||
queuedRanges = promauto.NewCounter(prometheus.CounterOpts{
|
queuedRanges = promauto.NewGauge(prometheus.GaugeOpts{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Name: RANGES_QUEUED,
|
Name: RANGES_QUEUED,
|
||||||
Help: "Number of range requests currently queued",
|
Help: "Number of range requests currently queued",
|
||||||
})
|
})
|
||||||
|
|
||||||
lastLoadedHeight = promauto.NewGauge(prometheus.GaugeOpts{
|
lastLoadedHeight = promauto.NewGauge(prometheus.GaugeOpts{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Name: LOADED_HEIGHT,
|
Name: LOADED_HEIGHT,
|
||||||
@ -114,7 +112,7 @@ func IncQueuedRanges() {
|
|||||||
// DecQueuedRanges decrements the number of queued range requests
|
// DecQueuedRanges decrements the number of queued range requests
|
||||||
func DecQueuedRanges() {
|
func DecQueuedRanges() {
|
||||||
if metrics {
|
if metrics {
|
||||||
queuedRanges.Add(-1)
|
queuedRanges.Dec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ func (sds *Service) Loop(wg *sync.WaitGroup) error {
|
|||||||
select {
|
select {
|
||||||
case blockRange := <-sds.queue:
|
case blockRange := <-sds.queue:
|
||||||
prom.DecQueuedRanges()
|
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 {
|
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)
|
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 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:
|
case <-sds.quitChan:
|
||||||
logrus.Infof("closing the statediff service loop worker %d", id)
|
logrus.Infof("closing the statediff service loop worker %d", id)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user