mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-11 04:00:05 +00:00
Change Positionining of Warning Log (#4850)
* change logging * change positioning of log * fix status test Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
parent
b7adf55336
commit
db21f98053
@ -276,13 +276,6 @@ func (s *Service) Status() error {
|
||||
if s.runError != nil {
|
||||
return s.runError
|
||||
}
|
||||
// use a 5 minutes timeout for block time, because the max mining time is 278 sec (block 7208027)
|
||||
// (analyzed the time of the block from 2018-09-01 to 2019-02-13)
|
||||
fiveMinutesTimeout := time.Now().Add(-5 * time.Minute)
|
||||
// check that web3 client is syncing
|
||||
if time.Unix(int64(s.latestEth1Data.BlockTime), 0).Before(fiveMinutesTimeout) {
|
||||
return errors.New("eth1 client is not syncing")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -522,6 +515,14 @@ func safelyHandlePanic() {
|
||||
|
||||
func (s *Service) handleDelayTicker() {
|
||||
defer safelyHandlePanic()
|
||||
|
||||
// use a 5 minutes timeout for block time, because the max mining time is 278 sec (block 7208027)
|
||||
// (analyzed the time of the block from 2018-09-01 to 2019-02-13)
|
||||
fiveMinutesTimeout := time.Now().Add(-5 * time.Minute)
|
||||
// check that web3 client is syncing
|
||||
if time.Unix(int64(s.latestEth1Data.BlockTime), 0).Before(fiveMinutesTimeout) {
|
||||
log.Warn("eth1 client is not syncing")
|
||||
}
|
||||
if !s.chainStartData.Chainstarted {
|
||||
if err := s.checkBlockNumberForChainStart(context.Background(), big.NewInt(int64(s.latestEth1Data.LastRequestedBlock))); err != nil {
|
||||
s.runError = err
|
||||
|
@ -337,8 +337,7 @@ func TestStatus(t *testing.T) {
|
||||
{isRunning: false, latestEth1Data: &protodb.LatestETH1Data{BlockTime: beforeFiveMinutesAgo}}: "",
|
||||
{isRunning: false, runError: errors.New("test runError")}: "",
|
||||
// "status is error" cases
|
||||
{isRunning: true, latestEth1Data: &protodb.LatestETH1Data{BlockTime: beforeFiveMinutesAgo}}: "eth1 client is not syncing",
|
||||
{isRunning: true, runError: errors.New("test runError")}: "test runError",
|
||||
{isRunning: true, runError: errors.New("test runError")}: "test runError",
|
||||
}
|
||||
|
||||
for web3ServiceState, wantedErrorText := range testCases {
|
||||
|
Loading…
Reference in New Issue
Block a user