Skip to content

Commit 02a271e

Browse files
committed
Do not wait after last simulation event
1 parent 2e23d12 commit 02a271e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cmd/run/run.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ func (s *Simulation) Name() string {
260260
func run(sims []*Simulation, extIP net.IP, size int) error {
261261
printWelcome(extIP.String())
262262
printHeader()
263-
for _, sim := range sims {
263+
for simN, sim := range sims {
264264
printMsg(sim, sim.HeaderMsg)
265265

266266
numOfHosts := size
@@ -273,7 +273,7 @@ func run(sims []*Simulation, extIP net.IP, size int) error {
273273
continue
274274
}
275275

276-
for _, host := range hosts {
276+
for hostN, host := range hosts {
277277
printMsg(sim, sim.FormatHost(host))
278278

279279
if !dryRun {
@@ -286,9 +286,11 @@ func run(sims []*Simulation, extIP net.IP, size int) error {
286286
printMsg(sim, sim.SuccessMsg)
287287
}
288288

289-
if !fast {
289+
// wait until context expires (unless fast mode or very last iteration)
290+
if !fast && ((simN < len(sims)-1) || (hostN < len(hosts)-1)) {
290291
<-ctx.Done()
291292
}
293+
292294
cancel()
293295
}
294296
}

0 commit comments

Comments
 (0)