admin管理员组文章数量:1123046
I am using LUASocket and lua-sec along with FreeSWITCH to upload recorded voicemails to a NodeJS application. I'm not sure why, but intermittently the connection blocks indefinitely, and sometimes the uploads of <1MB files take 2~3 minutes (figuring out why is not my issue right now). I've tried setting timeouts at the http and https level (as can be seen in the code below) but this doesn't seem to be effective at all.
multipart-post is from here
Lua version is 5.2, FreeSWITCH version is 1.10.12
http = require "socket.http"
https = require "ssl.https"
mp_post = require "resources.multipart-post"
https.TIMEOUT = 5
http.TIMEOUT = 5
arg_file = argv[1]
local file_to_upload = io.open(arg_file, "r")
local file_length = file_to_upload:seek("end")
file_to_upload:seek("set", 0)
local rq = mp_post.gen_request({
file = {
name = arg_file,
data = file_to_upload,
len = file_length
},
mailbox_id = tostring(arg_mailbox_id)
})
rq.url = ";
rq.headers["Authorization"] = "Bearer <auth_token>"
rq.sink = ltn12.sink.table(api_response)
r, code, h, s = https.request(rq) <--- This blocks indefinitely
Below this code block I have handling to control what happens if the upload times out, but it is never hit unless I set the values to 0.001
I see that there are 2 timeout modes, "b" and "t", "t" being for timeout control for the entire operation. The include for socket.http and ssl.https default to "b" mode, so I edited the LUA include files for both modules to change to "t" mode, and this also had no effect.
How do I force the upload to not take more than 5 seconds, so that I can play back hold music to the caller and retry the upload before they hang up from the silence?
本文标签: freeswitchLuasocket and luasec HTTPS request not honoring set timeoutStack Overflow
版权声明:本文标题:freeswitch - Luasocket and luasec HTTPS request not honoring set timeout - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736545065a1944434.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论