YNK
YNK

Reputation: 129

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

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.

Upvotes: 1

Views: 390

Answers (1)

Adolfo Garza
Adolfo Garza

Reputation: 3029

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
}

Upvotes: 3

Related Questions