Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

google apps script lock service

// BEGIN - start lock here

var lock = LockService.getScriptLock();
try {
    lock.waitLock(30000); // wait 30 seconds for others' use of the code section and lock to stop and then proceed
} catch (e) {
    Logger.log('Could not obtain lock after 30 seconds.');
    return HtmlService.createHtmlOutput("<b> Server Busy please try after some time <p>")
    // In case this a server side code called asynchronously you return a error code and display the appropriate message on the client side
    return "Error: Server busy try again later... Sorry :("
}
// note:  if return is run in the catch block above the following will not run as the function will be exited

//  Do lots of stuff - ie apply dynamic background colors based on previous entries colors, define the target range and set values, set data validations  

lock.releaseLock();

// END - end lock here
Comment

PREVIOUS NEXT
Code Example
Javascript :: innerwidth react 
Javascript :: detecting screen width in jquery 
Javascript :: babel cdn react 
Javascript :: check if the method is not called in jest 
Javascript :: get all values checked checkboxes jquery 
Javascript :: onclick jquery show alert 
Javascript :: how to remove cors error from node app 
Javascript :: get value from url 
Javascript :: append before jquery 
Javascript :: eslint console log 
Javascript :: node format variable in string 
Javascript :: javascript today minus 1 day 
Javascript :: javascript distance between two points 
Javascript :: javascript detect ios device 
Javascript :: css how to make a div scrollable 
Javascript :: how to get element by attribute value in javascript 
Javascript :: sequelize undo last migration 
Javascript :: how to get all elements with same class in javascript 
Javascript :: history.push in nextjs 
Javascript :: how to see if user clicked key in js 
Javascript :: wp_enqueue_script bootstrap 5 
Javascript :: for loop in ejs 
Javascript :: fatal no configured push destination 
Javascript :: discord bot status javascript 
Javascript :: javascript fill 2d array 
Javascript :: jquery select by data attribute 
Javascript :: change onclick attribute with javascrip 
Javascript :: how to wait foreach javascript 
Javascript :: js get string before character 
Javascript :: jquery transform scale 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =