Splash resource_timeout 属性

时间:2020-12-03 21:22:53

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
}