Splash resource_timeout 属性

resource_timeout属性用于设置加载的超时时间,单位是秒,如果设置为 0 代表不检测超时,如下,设置超时时间为 0.1 秒:

function main(splash)
  splash.resource_timeout = 0.1
  assert(splash:go('https://www.taobao.com/'))
  return splash:png()
end

执行之后抛出异常:

{
    "description": "Error happened while executing Lua script",
    "info": {
        "type": "LUA_ERROR",
        "source": "[string \"function main(splash)\r...\"]",
        "message": "Lua error: [string \"function main(splash)\r...\"]:3: network5",
        "error": "network5",
        "line_number": 3
    },
    "type": "ScriptError",
    "error": 400
}

 

 

 

 

 

 

    

posted @ 2019-03-18 15:09  孔雀东南飞  阅读(352)  评论(0编辑  收藏  举报