Skip to content

Commit

Permalink
fallback to log
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaidashenko committed Feb 10, 2025
1 parent ab61cd2 commit b0a3226
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions pkg/solana/logpoller/blocks_sorter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,12 @@ import (
"context"
"sync"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services"
)

const blocksChBuffer = 16

var promPoolRPCNodeHighestSeenBlock = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "block_sorter_queue",
Help: "The highest seen block for the given RPC node",
}, []string{})

type blocksSorter struct {
// service state management
services.Service
Expand Down Expand Up @@ -77,8 +69,10 @@ func (p *blocksSorter) readBlocks(ctx context.Context) {
}

p.mu.Lock()
promPoolRPCNodeHighestSeenBlock.WithLabelValues().Set(float64(len(p.readyBlocks)))
p.readyBlocks[block.SlotNumber] = block
if len(p.readyBlocks) >= 1024 {
p.lggr.Warnf("Number of ready blocks exceeds is too large: %d", len(p.readyBlocks))
}
p.mu.Unlock()
// try leaving a msg that new block is ready
select {
Expand Down Expand Up @@ -119,7 +113,6 @@ func (p *blocksSorter) readNextReadyBlock() *Block {

slotNumber := element.Value.(uint64)
block, ok := p.readyBlocks[slotNumber]
promPoolRPCNodeHighestSeenBlock.WithLabelValues().Set(float64(len(p.readyBlocks)))
if !ok {
return nil
}
Expand Down

0 comments on commit b0a3226

Please sign in to comment.