Google app script timeout ~ 5 minutes?

后端 未结 9 2181
粉色の甜心
粉色の甜心 2020-11-22 08:31

My google app script is iterating through the user\'s google drive files and copying and sometimes moving files to other folders. The script is always stopped after 5 minute

9条回答
  •  半阙折子戏
    2020-11-22 08:40

    Anton Soradoi's answer seems OK but consider using Cache Service instead of storing data into a temporary sheet.

     function getRssFeed() {
       var cache = CacheService.getPublicCache();
       var cached = cache.get("rss-feed-contents");
       if (cached != null) {
         return cached;
       }
       var result = UrlFetchApp.fetch("http://example.com/my-slow-rss-feed.xml"); // takes 20 seconds
       var contents = result.getContentText();
       cache.put("rss-feed-contents", contents, 1500); // cache for 25 minutes
       return contents;
     }
    

    Also note that as of April 2014 the limitation of script runtime is 6 minutes.


    G Suite Business / Enterprise / Education and Early Access users:

    As of August 2018, max script runtime is now set to 30 minutes for these users.

提交回复
热议问题