1// BEGIN - start lock here
2
3var lock = LockService.getScriptLock();
4try {
5 lock.waitLock(30000); // wait 30 seconds for others' use of the code section and lock to stop and then proceed
6} catch (e) {
7 Logger.log('Could not obtain lock after 30 seconds.');
8 return HtmlService.createHtmlOutput("<b> Server Busy please try after some time <p>")
9 // In case this a server side code called asynchronously you return a error code and display the appropriate message on the client side
10 return "Error: Server busy try again later... Sorry :("
11}
12// note: if return is run in the catch block above the following will not run as the function will be exited
13
14// Do lots of stuff - ie apply dynamic background colors based on previous entries colors, define the target range and set values, set data validations
15
16lock.releaseLock();
17
18// END - end lock here