Pause or wait after status code 500


is it possible to define a pause after a request finished with status code 500?
In my test scenario I want to send 10000 requests for example.
After 1000 requests the server is crashing and restarting.
During that time all subsequent requests fail until the server has restarted.

I want to add a pause after the request which caused a status code 500,
so that the server is not getting any new requests while it is restarting.

Usually, you want to tell your develpment team that the server can’t handle that many requests, if its crashing.

You can use change your scripts to handle 500 http code and make it pause but I don’t think thats the right way to approach it.

Yes, I already told them that the server can’t handle that many requests.

I still want to test my simulation with a pause after I get a status code 500.
A very simple and basic example of my code looks like this:

def getConnectionStatistics (requests: Int) = repeat(requests) {
  exec(http("Get Connection Statistics")

What do I have to add or change in order to pause the simulation after status code 500?
Right now I only check for status code 200.

If thats not possible could I maybe use the method asLongAs?
Here then I would like to check if the request returns status code 500 and then wait for a specific time.

Any help or tips are highly appreciated.

The method above is executed with the following commands:

A simple way would be to capture status code in a variable and then a doIf statement


.doIf("${status_code}", “500”)