更新时间:2023-12-03 16:53:10
您可以使用 锁定服务.
锁定服务允许脚本阻止并发访问代码段.当您有多个用户或进程修改共享资源并希望防止冲突.
The Lock Service allows scripts to prevents concurrent access to sections of code. This can be useful when you have multiple users or processes modifying a shared resource and want to prevent collisions.
function doGet(){
var lock = LockService.getScriptLock();
lock.waitLock(10000); // in milliseconds
// Your code
lock.releaseLock();
}