开发者

How to prevent UrlFetchApp.fetch from going on forever? [duplicate]

This question already has answers here: Lower the timeout for urlFetchApp.fetch function (1 answer) Timeout Error - DHL API to Google Sheets - UrlFetchApp (1 answer) Closed 14 hours ago.

This post was edited and submitted for review 6 hours ago.

First of all let me clarify that I have read the answers of the similar questions

Lower the timeout for urlFetchApp.fetch function and Timeout Error - DHL API to Google Sheets 开发者_JAVA百科- UrlFetchApp

but this question is different. Here I'm asking why UrlFetchApp.fetch and UrlFetchApp.fetchAll are blocking the script execution entirely (never return response) until you get an "Exceeded maximum execution time" error. It happens occasionally for some URLs like the one at the example shown bellow

function fetch_test() {
  const res = UrlFetchApp.fetch('https://www.usnews.com/news/world/articles/2022-12-06/turkey-again-threatens-greece-for-arming-aegean-islands')
}

You will notice that fetch never ends until you get an "Exceeded maximum execution time" error. It happens to fetch and fetchAll but I can't figure out why. How can I prevent/handle this situation?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜