Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module github.com/ethersphere/bee/v2

go 1.24.0

toolchain go1.24.2

require (
contrib.go.opencensus.io/exporter/prometheus v0.4.2
github.com/armon/go-radix v1.0.0
Expand Down
19 changes: 15 additions & 4 deletions pkg/salud/salud.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import (
const loggerName = "salud"

const (
wakeup = time.Minute * 5
requestTimeout = time.Second * 10
initialBackoffDelay = 5 * time.Second
maxBackoffDelay = 5 * time.Minute
backoffFactor = 2
DefaultMinPeersPerBin = 4
DefaultDurPercentile = 0.4 // consider 40% as healthy, lower percentile = stricter duration check
DefaultConnsPercentile = 0.8 // consider 80% as healthy, lower percentile = stricter conns check
Expand Down Expand Up @@ -97,14 +99,20 @@ func (s *service) worker(startupStabilizer stabilization.Subscriber, mode string
s.logger.Debug("node warmup check completed")
}

for {
currentDelay := initialBackoffDelay

for {
s.salud(mode, minPeersPerbin, durPercentile, connsPercentile)

select {
case <-s.quit:
return
case <-time.After(wakeup):
case <-time.After(currentDelay):
}

currentDelay *= time.Duration(backoffFactor)
if currentDelay > maxBackoffDelay {
currentDelay = maxBackoffDelay
}
}
}
Expand Down Expand Up @@ -135,7 +143,7 @@ func (s *service) salud(mode string, minPeersPerbin int, durPercentile float64,
bins [swarm.MaxBins]int
)

_ = s.topology.EachConnectedPeer(func(addr swarm.Address, bin uint8) (stop bool, jumpToNext bool, err error) {
err := s.topology.EachConnectedPeer(func(addr swarm.Address, bin uint8) (stop bool, jumpToNext bool, err error) {
wg.Add(1)
go func() {
defer wg.Done()
Expand Down Expand Up @@ -164,6 +172,9 @@ func (s *service) salud(mode string, minPeersPerbin int, durPercentile float64,
}()
return false, false, nil
}, topology.Select{})
if err != nil {
s.logger.Error(err, "error iterating over connected peers", "mode", mode)
}

wg.Wait()

Expand Down
2 changes: 1 addition & 1 deletion pkg/storer/internal/stampindex/stampindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func Delete(s storage.Writer, scope string, stamp swarm.Stamp) error {
StampIndex: stamp.Index(),
}
if err := s.Delete(item); err != nil {
return fmt.Errorf("failed to delete stampindex.Item %s: %w", item, err)
return fmt.Errorf("failed to delete stampindex.Item %s: %w", item.ID(), err)
}
return nil
}
Loading