Unable to Set Loop Conditions with AsLongAs / foreach

I’m executing this code:

//session.next = “http://some.url.that.gets.my.json

exec(doRepoSearch) // executes HTTP get on “session.next”
.foreach("${userFiles}",“file”) {
exec(grabUserFile) //repeated http get on links returned from doRepoSearch
.exec(session=> {
println(“Next Link:” + session(“next”).as[String])
val newSession = session.set(“next”,"") //reset to emulate stop condition
)//eo asLongAs

but it never hits the final .exec block, it just loops continuously using the original value of “session.next” - i.e. the reset line never gets hit. If I remove the foreach block, the final block gets hit and the loop ends?


I’m using

gatling-charts-highcharts-2.0.0-SNAPSHOT - downloaded today.


Hey Alan,

I haven’t been able to reproduce so far.
Here’s my test and properly reaches reset: https://gist.github.com/slandelle/8923867

Could be something weird with crash handling.
Are you sure you don’t do anything weird in grabUserFile, like losing the loop index attribute?

Mmmmm…maybe, more investigations and I’ll report back…

Sent using my ‘Smart Phone’, excuse the typos…

Hi Stéphane - you were right, I was misreading some of my own logic - both these code samples work fine.


Honestly, that’s a relief: you’ve found some nasty bugs lately!
Thanks for your feedback.

ha ha !! I’ll keep up the ‘good’ work…

That’s greatly appreciated!