Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 0 deletions openapi/SwarmCommon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,8 @@ components:
type: integer
committedDepth:
type: integer
isWarmingUp:
type: boolean

StatusPeersResponse:
type: object
Expand Down
9 changes: 7 additions & 2 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ import (
"github.com/ethersphere/bee/v2/pkg/settlement/swap/erc20"
"github.com/ethersphere/bee/v2/pkg/status"
"github.com/ethersphere/bee/v2/pkg/steward"
storage "github.com/ethersphere/bee/v2/pkg/storage"
"github.com/ethersphere/bee/v2/pkg/storage"
"github.com/ethersphere/bee/v2/pkg/storageincentives"
"github.com/ethersphere/bee/v2/pkg/storageincentives/staking"
storer "github.com/ethersphere/bee/v2/pkg/storer"
"github.com/ethersphere/bee/v2/pkg/storer"
"github.com/ethersphere/bee/v2/pkg/swarm"
"github.com/ethersphere/bee/v2/pkg/topology"
"github.com/ethersphere/bee/v2/pkg/topology/lightnode"
Expand Down Expand Up @@ -220,6 +220,7 @@ type Service struct {
redistributionAgent *storageincentives.Agent

statusService *status.Service
isWarmingUp bool
}

func (s *Service) SetP2P(p2p p2p.DebugService) {
Expand Down Expand Up @@ -387,6 +388,10 @@ func (s *Service) SetProbe(probe *Probe) {
s.probe = probe
}

func (s *Service) SetIsWarmingUp(v bool) {
s.isWarmingUp = v
}

// Close hangs up running websockets on shutdown.
func (s *Service) Close() error {
s.logger.Info("api shutting down")
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type statusSnapshotResponse struct {
IsReachable bool `json:"isReachable"`
LastSyncedBlock uint64 `json:"lastSyncedBlock"`
CommittedDepth uint8 `json:"committedDepth"`
IsWarmingUp bool `json:"isWarmingUp"`
}

type statusResponse struct {
Expand Down Expand Up @@ -96,6 +97,7 @@ func (s *Service) statusGetHandler(w http.ResponseWriter, _ *http.Request) {
IsReachable: ss.IsReachable,
LastSyncedBlock: ss.LastSyncedBlock,
CommittedDepth: uint8(ss.CommittedDepth),
IsWarmingUp: s.isWarmingUp,
})
}

Expand Down
6 changes: 5 additions & 1 deletion pkg/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func NewBee(

apiService.Mount()
apiService.SetProbe(probe)

apiService.SetIsWarmingUp(true)
apiService.SetSwarmAddress(&swarmAddress)

apiServer := &http.Server{
Expand Down Expand Up @@ -1005,6 +1005,10 @@ func NewBee(
return nil, fmt.Errorf("pullsync protocol: %w", err)
}

time.AfterFunc(warmupTime, func() {
apiService.SetIsWarmingUp(false)
})

stakingContractAddress := chainCfg.StakingAddress
if o.StakingContractAddress != "" {
if !common.IsHexAddress(o.StakingContractAddress) {
Expand Down
Loading