Merge PR #2274: simulation: Stop on SIGTERM
This commit is contained in:
parent
ffb4c5ec7d
commit
c800bc7a1a
@ -114,5 +114,6 @@ BUG FIXES
|
||||
* [ledger] [\#2064](https://github.com/cosmos/cosmos-sdk/issues/2064) Fix inability to sign and send transactions via the LCD by
|
||||
loading a Ledger device at runtime.
|
||||
* [\#2158](https://github.com/cosmos/cosmos-sdk/issues/2158) Fix non-deterministic ordering of validator iteration when slashing in `gov EndBlocker`
|
||||
* [simulation] \#1924 Make simulation stop on SIGTERM
|
||||
|
||||
* Tendermint
|
||||
|
||||
@ -6,7 +6,9 @@ import (
|
||||
"math"
|
||||
"math/rand"
|
||||
"os"
|
||||
"os/signal"
|
||||
"sort"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -76,6 +78,16 @@ func SimulateFromSeed(
|
||||
header := abci.Header{Height: 0, Time: timestamp}
|
||||
opCount := 0
|
||||
|
||||
// Setup code to catch SIGTERM's
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-c
|
||||
fmt.Printf("Exiting early due to SIGTERM, on block %d, operation %d\n", header.Height, opCount)
|
||||
DisplayEvents(events)
|
||||
os.Exit(128 + int(syscall.SIGTERM))
|
||||
}()
|
||||
|
||||
var pastTimes []time.Time
|
||||
var pastSigningValidators [][]abci.SigningValidator
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user