Unable to Set Loop Conditions with AsLongAs / foreach

Hi,
I’m executing this code:

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

.asLongAs(session=>session(“next”).as[String].length()>0)(
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
newSession
}
)
)//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?

Al

I’m using

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

Al

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…
Thanks…

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.

Al

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!