Google Apps Script定时触发器异常延迟1-3分钟触发求助
Google Apps Script 定时触发器延迟触发问题
我有个处理43k行数据的主函数,为了避免超时,用定时触发器实现中断后从断点重启,断点数据存在Properties Service里。主函数会调用自己写的setrebootTrigger函数(设置1秒后触发的触发器),然后立即终止自身。
触发器设置函数代码
// 设置定时触发器以重启主函数 function setrebootTrigger() { //manageTriggers(); 已禁用,尝试提速但没用 :/ // 设置基于时间的触发器,1秒后继续处理 ScriptApp.newTrigger('organizeData') .timeBased() .after(1000) .create(); // logToSheet("Freeze process trigger created."); 调试期间暂不需要,已禁用 }
不管把触发器设置成1秒、5秒、20秒还是0.5秒,主函数都要等1-3分钟才会再次启动。我加了日志排查,发现设置触发器的日志和主函数启动的日志间隔1-3分钟,确认问题出在触发器本身:
日志片段1
15/05/2024 11:58:13 AM: Batch update completed. 15/05/2024 11:58:15 AM: Properties updated. Ending current iteration of loop. **15/05/2024 11:58:16 AM: freeze process trigger set, freezing process to avoid timeout 15/05/2024 11:59:30 AM: main function started!** 15/05/2024 11:59:31 AM: Set YouTube batch size to 50 and RoosterTeeth batch size to 1500. 15/05/2024 11:59:31 AM: Set desired show name: On The Spot 15/05/2024 11:59:32 AM: Processing new batch of YouTube rows from index 100 to 150.
日志片段2
15/05/2024 11:53:38 AM: Batch update completed. 15/05/2024 11:53:39 AM: Properties updated. Ending current iteration of loop. **15/05/2024 11:53:40 AM: freeze process trigger set, freezing process to avoid timeout 15/05/2024 11:55:14 AM: main function started!** 15/05/2024 11:55:15 AM: Set YouTube batch size to 50 and RoosterTeeth batch size to 1500. 15/05/2024 11:55:16 AM: Set desired show name: On The Spot 15/05/2024 11:55:16 AM: Processing new batch of YouTube rows from index 50 to 100.
触发器触发极不稳定,打开触发器标签页完全看不到它有动作。
内容的提问来源于stack exchange,提问作者user25065751
相关产品推荐
相关产品推荐

