Hi,
I have a trigger timebased (every fifteen minutes), and I want to make sure that script triggered is completly done before another trigger starts to run.
So I'm using getDocumentLock - and WaitLock fucntion()
It works most of the time, but after a while, i don't know why, waitock is ok but a script is still running !
Thanks for your help !
Here is my code
// every 15 minutes
function trigger_run()
{
let b_ok = true;
let lock = LockService.getDocumentLock();
try
{
lock.waitLock(2000);
Run_script();
SpreadsheetApp.flush();
}
catch (e)
{
Logger.log(e);
b_ok=false;
}
finally
{
if (lock.hasLock()) lock.releaseLock();
return b_ok;
}
}