# Gatling retry request

**URL:** https://community.gatling.io/t/gatling-retry-request/7851
**Category:** Gatling (Open-Source)
**Created:** [April 18, 2023, 4:50pm UTC](https://community.gatling.io/t/gatling-retry-request/7851 "2023-04-18T16:50:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![balaji](https://avatars.discourse-cdn.com/v4/letter/b/2bfe46/32.png) [@balaji](https://community.gatling.io/u/balaji)
#### Post date: [April 18, 2023, 4:50pm UTC](https://community.gatling.io/t/gatling-retry-request/7851/1 "2023-04-18T16:50:37Z")

</div>

Hi,  
I have a below request

```auto
    val saml = scenario("ACM Token")
      .exec(http("SP")
        .post("https://xxxxxx/api/saml")
        .header("Content-Type", "application/x-www-form-urlencoded")
        .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36")
        .header("Accept-Encoding", "gzip, deflate, br")
        .formParam("RelayState", Configuration.relayState)
        .formParam("SAMLResponse", Configuration.saml)
      )
      .exec(getCookieValue(CookieKey("acmToken").withDomain("xxxx").withPath("/")))
      .exec { session =>
        val token = session("acmToken").as[String]
        val token2 = "Bearer " + token
        session.set("acmToken", token2)
      }
      .exec(session => {
        System.setProperty("acmToken", session("acmToken").as[String])
        session
      })

```

which is failing randomly when user count is increased and below error is seen

```auto
io.gatling.http.client.impl.RequestTimeoutException: Request timeout to xxxx.com/10.161.134.82:443 after 60000 ms
21:40:10.610 [DEBUG] i.g.h.e.r.DefaultStatsProcessor - Request 'SP' failed for user 462: Request timeout to xxxx.com/10.161.134.82:443 after 60000 ms
>>>>>>>>>>>>>>>>>>>>>>>>>>
Request:
SP: KO Request timeout to xxxx.com/10.161.134.82:443 after 60000 ms

```

how can i retry this saml request till the domain is reachable?

---

<div class="post-metadata">

### Author: ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)
#### Post date: [April 18, 2023, 4:53pm UTC](https://community.gatling.io/t/gatling-retry-request/7851/2 "2023-04-18T16:53:28Z")

</div>

Use `tryMax`: [https://gatling.io/docs/gatling/reference/current/core/scenario/#trymax](https://gatling.io/docs/gatling/reference/current/core/scenario/#trymax)

---

<div class="post-metadata">

### Author: ![system](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/b/b148e0742de35c6280726cabf3ecd3de2d320f63.png) [@system](https://community.gatling.io/u/system)
#### Post date: [May 18, 2023, 4:53pm UTC](https://community.gatling.io/t/gatling-retry-request/7851/3 "2023-05-18T16:53:46Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
