Is there any way where i can define maximum duration to execute any schedule script?

378 Views Asked by At

IE. I implement schedule script, which contain block of statements to execute, now i need to define that the execution process need to complete within a 1:30 minute. after 1:30 minute execution should be stop and give message.

1

There are 1 best solutions below

0
On

There's currently no timeout method in Netsuite for serverside scripts. What you can do is set up a variable that holds the end time and check on it from time to time like. Something like this:

var maxExecutionTime = 90; //In Seconds
var endTime = new Date();
endTime.setSeconds(endTime.getSeconds() + maxExecutionTime);

if(new Date() > endTime){
    //exit
}