mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
flag to stop before stage (#2194)
This commit is contained in:
parent
bc271f92ce
commit
4533b59724
@ -118,3 +118,19 @@ func HeadersSeal() bool {
|
||||
})
|
||||
return headersSeal
|
||||
}
|
||||
|
||||
var (
|
||||
stopBeforeStage string
|
||||
stopBeforeStageFlag sync.Once
|
||||
)
|
||||
|
||||
func StopBeforeStage() string {
|
||||
f := func() {
|
||||
v, _ := os.LookupEnv("STOP_BEFORE_STAGE") // see names in eth/stagedsync/stages/stages.go
|
||||
if v != "" {
|
||||
stopBeforeStage = v
|
||||
}
|
||||
}
|
||||
stopBeforeStageFlag.Do(f)
|
||||
return stopBeforeStage
|
||||
}
|
||||
|
@ -3,10 +3,12 @@ package stagedsync
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/ledgerwatch/erigon/common"
|
||||
"github.com/ledgerwatch/erigon/common/debug"
|
||||
"github.com/ledgerwatch/erigon/eth/stagedsync/stages"
|
||||
"github.com/ledgerwatch/erigon/ethdb"
|
||||
"github.com/ledgerwatch/erigon/log"
|
||||
@ -166,6 +168,11 @@ func (s *State) Run(db ethdb.RwKV, tx ethdb.RwTx) error {
|
||||
|
||||
_, stage := s.CurrentStage()
|
||||
|
||||
if string(stage.ID) == debug.StopBeforeStage() { // stop process for debugging reasons
|
||||
log.Error("STOP_BEFORE_STAGE env flag forced to stop app")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if stage.Disabled {
|
||||
logPrefix := s.LogPrefix()
|
||||
message := fmt.Sprintf(
|
||||
|
Loading…
Reference in New Issue
Block a user