var lock = LockService.getPublicLock();
lock.waitLock(30000);
//код
lock.releaseLock();
var lock = LockService.getPublicLock();
try {
lock.waitLock(30000);
return success();
} catch (err) {
Logger.log('Could not obtain lock after 30 seconds.');
return failure();
}
var lock = LockService.getPublicLock();
var success = lock.tryLock(30000);
if (!success) {
Logger.log('Could not obtain lock after 30 seconds.');
}