Orchestrator Function: Sleep For and Wait For

by Simon Sparks · 1 November 2025

To use this function add it to the class library file named Utilities.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: Utilities.ts

Function sleepFor and waitFor

Description: This is a memory inefficient sleep, it is ok to use for short periods of time e.g. less than 60 seconds.

publicstaticsleepFor(intSeconds:number):void{
System.sleep(intSeconds*1000);
}

Description: This is a memory efficient wait for time, it is much more sensible to use for any period of time longer than 60 seconds.

publicstaticwaitFor(intSeconds:number):void{
letdteNow: Date=newDate();

dteNow.setTime(dteNow.getTime()+intSeconds*1000);

System.waitUntil(dteNow,intSeconds*1000);
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like