Error Script time out

Here’s an outline with best practices for making your inquiry.

My question: I am getting script timeout error .
I am new to postman and trying to run some codes to loop through 6000 records and validate the values. Currently in my code i have only set to go through 1000, but as the program runs it thrown error as script time out error.

can anyone please review why and what I should do to rectify this problem . Thanks a lot in advance.

Details (like screenshots):

//Check that the service is active

pm.test(“Status code is 200”, function () {

pm.response.to.have.status(200);

pm.response.to.be.json;

});

//get the response data

let jsonData = pm.response.json();

//variable declaration to count how many have a reading Type ID

let vPass = 0;

let vFail = 0;

//variable declaration to count how many have Forecast values

let vForecast0 = 0;

let vForecast1 = 0;

//Variable to hold no of records in the reponse.

var data = pm.response.json().forecastData.generatedMW;

//Vairiable to hold the response object

var readingTypeID;

var forecast;

//Log how many records are in the response

console.log(“Total No of Records :” + data.length);

//Check if the file is in json format

pm.test(“File is Json”, function () {

    pm.response.to.be.json;

});

setTimeout(function(){}, 2000000);

//Go through each object in responsebody

for (let i=0;i < 1000;i++)

{

//Assign the value for each object iteration

readingTypeID = pm.response.json().forecastData.generatedMW[i].readingTypeID;

forecast= pm.response.json().forecastData.generatedMW[i].forecast;

    //Check the readingTypeID

    switch (readingTypeID) {

        case "FL":

            vPass++;

            break;

        case "FM":

            vPass++;

            break;

        case "FH":

            vPass++;

            break;

        default:

            vFail++;

    }

     //Check the Forecast Value

    if (forecast >= 0)

    {

        vForecast1++;

    }

    else

    {

        vForecast0++;

    }

}

//Print all the values to Console.

console.log ("vPass " + vPass);

console.log ("vFail " + vFail);

console.log ("vForecast1 " + vForecast1);

console.log ("vForecast0 " + vForecast0);

I’ve already tried: I have tried to increase the time by adding the script “setTimeout(function(){}, 2000000);” << Not sure if this is correct and in the right place.