Reputation: 61
I need to test an external URL, and if it fails, fail faster than the default (3 minutes, apparently). Numerous posts on several forums, including an "enhancement request" to Google, that have gone unanswered, so I thought I'd try here again.
Has anyone conjured a way to do this?
In my particular case, I don't care about getting any content back; my task is simply to test the URL and see if the remote server is alive and responds at all. So, maybe is there a way to change the parameters or headers in the request, to make it "reply instantly or fail quickly" ? For me, maybe ~30 seconds would be fast enough for failures.
Cross posted here: https://www.reddit.com/r/GoogleAppsScript/comments/iqh9dl/how_to_change_lower_the_timeout_for/
Upvotes: 3
Views: 1299
Reputation: 2998
In Apps Script the UrlFetchApp.fetch
method doesn't accept any callback nor custom timeout parameter. Unlike it does for example in Google Cloud.
Due to the synchronous nature of Apps Script is impossible to wrap the function result in a timeout either.
The feature of adding a custom timeout parameter has been requested so feel free to star the issue in order to increase its visibility. Here is the link.
Upvotes: 3