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)
..."]",
        "message": "Lua error: [string "function main(splash)
..."]:3: network5",
        "error": "network5",
        "line_number": 3
    },
    "type": "ScriptError",
    "error": 400
}

    

原文地址:https://www.cnblogs.com/pzk7788/p/10552280.html