# Second "exec" in "during" being executed a limited number of times

**URL:** <https://community.gatling.io/t/second-exec-in-during-being-executed-a-limited-number-of-times/717>\
**Category:** Gatling (Open-Source)\
**Created:** [December 10, 2013, 9:16pm UTC](https://community.gatling.io/t/second-exec-in-during-being-executed-a-limited-number-of-times/717 "2013-12-10T21:16:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Price](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@John\_Price](https://community.gatling.io/u/John_Price)\
**Post date:** [December 10, 2013, 9:16pm UTC](https://community.gatling.io/t/second-exec-in-during-being-executed-a-limited-number-of-times/717/1 "2013-12-10T21:16:21Z")

</div>

Config included below, but basically what I want to do is:

- define a chain of two requests, the second depending on the first

- have users keep executing that chain for some period of time

I created a chain with two “exec” calls, and then wrapped that in a “during”. The first exec (“get\_code”) is getting run the number of times I’d expect (for the config below, about 1000 times over 40s), but the second one (“exchange\_code”) seems to happen around (but not always exactly) once for each user (in my last run, it happened 11 times; in a run with 60 users, it will get called ~60 times).

Just getting started with Gatling. Am I missing something obvious? Or does this not work the way I’m expecting it to?

This is using v1.5.3

Thanks,  
John.

class Auth2SimpleSimulation extends Simulation {

val durationSeconds = 30

val httpConf = httpConfig  
.baseURL(“[https://example.com](https://example.com)”)  
.disableFollowRedirect

val urlFormPostHeaders = Map(  
“Content-Type” → “application/x-www-form-urlencoded”)

val chain =  
exec(  
http(“get\_code”)  
.post("/rest/v2/auth/code")  
.headers(urlFormPostHeaders)  
.param(“gameId”, “loadtest”)  
.param(“provider”, “anonymous”)  
.check(status.is(200))  
.check(jsonPath(“code”).find.saveAs(“auth\_code”)))  
.exec(  
http(“exchange\_code”)  
.post("/rest/v2/auth/token")  
.headers(urlFormPostHeaders)  
.basicAuth(“test”, “test”)  
.param(“grantType”, “authorization\_code”)  
.param(“code”, “${auth\_code}”)  
.check(status.is(200)))

val scn = scenario(“Basic Login”)  
.during(durationSeconds) {  
chain  
}  
setUp(scn.users(10).ramp(10).protocolConfig(httpConf))  
}

---

<div class="post-metadata">

**Author:** ![John\_Price](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@John\_Price](https://community.gatling.io/u/John_Price)\
**Post date:** [December 10, 2013, 9:21pm UTC](https://community.gatling.io/t/second-exec-in-during-being-executed-a-limited-number-of-times/717/2 "2013-12-10T21:21:57Z")

</div>

Of course, right after I post I think to enable logging and see this:

> Bypassing cached Request ‘exchange\_code’: Scenario ‘Basic Auth2 Login’, UserId #8

Adding .disableCaching to my httpConf solved the problem.

John.

---

<div class="post-metadata">

**Author:** ![Nicolas\_R](https://avatars.discourse-cdn.com/v4/letter/n/f14d63/32.png) [@Nicolas\_R](https://community.gatling.io/u/Nicolas_R)\
**Post date:** [December 10, 2013, 9:23pm UTC](https://community.gatling.io/t/second-exec-in-during-being-executed-a-limited-number-of-times/717/3 "2013-12-10T21:23:25Z")

</div>

Cool. I was about to ask you to check this point.

cheers  
Nicolas
