[google-apps-script] How to use Utilities.sleep() function

What is the exact use of Utilities.sleep() function? Should we use it between function calls or API calls?

I use the Utilities.sleep(1000) in-between function calls, is it right? Will it slow down the execution time?

This question is related to google-apps-script

The answer is


Serge is right - my workaround:

function mySleep (sec)
{
  SpreadsheetApp.flush();
  Utilities.sleep(sec*1000);
  SpreadsheetApp.flush();
}

Some Google services do not like to be used to much. Quite recently my account was locked because of script, which was sending two e-mails per second to the same user. Google considered it as a spam. So using sleep here is also justified to prevent such situations.