How to check if a function in Google App Script is already being executed by another user? -
i have function (function doget()) in google app script being called chrome extension. function being called everytime user clicks button in chrome extension popup.html. button in popup.html simultaneously being clicked 30+ users. can place check if function being executed 1 user, next user cannot execute till ?
you can use lock service of app script.
the lock service allows scripts prevents concurrent access sections of code. can useful when have multiple users or processes modifying shared resource , want prevent collisions.
function doget(){ var lock = lockservice.getscriptlock(); lock.waitlock(10000); // in milliseconds // code lock.releaselock(); }
wiki
Comments
Post a Comment