Orchestrator Function: sleepFor and waitFor

by Simon Sparks · 20 January 2026

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.

public static sleepFor(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.

public static waitFor(intSeconds: number): void {
  let dteNow: Date = new Date();

  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