Skip to content

Commit a2a6126

Browse files
committed
run finished after x seconds
1 parent 1eded7b commit a2a6126

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

perfTest/cmd/silent.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ var (
4646
simulEnvironment *stream.Environment
4747
)
4848

49-
func checkTtl() {
50-
if ttl > 0 {
49+
func checkRunDuration() {
50+
if runDuration > 0 {
5151
start := time.Now()
52-
ticker := time.NewTicker(1 * time.Minute)
52+
ticker := time.NewTicker(10 * time.Second)
5353
go func() {
5454
for {
5555
select {
5656
case _ = <-ticker.C:
57-
v := time.Now().Sub(start).Minutes()
58-
if v >= float64(ttl) {
59-
logInfo("Closing due TTL")
60-
os.Exit(1)
57+
v := time.Now().Sub(start).Seconds()
58+
if v >= float64(runDuration) {
59+
logInfo("Stopping after %s seconds", runDuration)
60+
os.Exit(0)
6161
}
6262
}
6363
}
@@ -165,7 +165,7 @@ func startSimulation() error {
165165
checkErr(err)
166166
}
167167
printStats()
168-
checkTtl()
168+
checkRunDuration()
169169

170170
return err
171171
}

0 commit comments

Comments
 (0)