[Gatling2] RendezVous in a loop

Hi all,

It looks like if RendezVous does not work inside a loop (probably because the counter has not been reset).

Could you confirm?

I have implement the following to make a rendezVous inside a loop:

val rendezVousInLoop = // wait for previous loop to finish asLongAs(session => (session("exitRendezVousCounter")).as[AtomicInteger].get() % humansNumber != 0) { println("Waiting for player to exit previous RV") pause(1) } .exec { session => // increment entries enterRendezVousCounter.incrementAndGet() // println("*********************** Increment entry counter " + enterRendezVousCounter.get()) session } // wait for other players .asLongAs(session => (session("enterRendezVousCounter")).as[AtomicInteger].get() % humansNumber != 0) { println("Waiting for player to enter RV") pause(1) } .exec { session => // increment exit exitRendezVousCounter.incrementAndGet() // println("*********************** Increment exit counter " + exitRendezVousCounter.get()) session }

It works, but the following log is never displayed:

`
println(“Waiting for player to exit previous RV”)

`

Probably a scala issue?

I forgot to say that the counters are AtomicInteger:

`
var enterRendezVousCounter = new AtomicInteger(0)
var exitRendezVousCounter = new AtomicInteger(0)

`

And *humansNumber* is the number of users to synchronize.

It looks like if RendezVous does not work inside a loop (probably because the counter has not been reset).

Well, it just might not we working the way you intend it :slight_smile:

It works, but the following log is never displayed:

Yep, because the block with the print is only executed once, when the simulation is loaded. Only Gatling DSL components and functions passed to them will become part of the scenario and will be triggered every time a user reaches it.