I'm doing a long poll request setting a timeout of 10 sec but it does not seem to be working. My understanding is if we don't get a response from backend within the specified timeout, backend call should end with timedout
error code. Is it so?
But if I use a very small timeout e.g. 0.001, it works. So I think if a request is already sent to backend, timeout does not work.
For my long poll request, if my network is down when a request is sent and waiting for response, lua socket hangs there and it never recovers from that situation. Could you please help me if I can handle this in any other way?
My Lua version - Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio (double int32)
Code Spinet:
local http = require "socket.http"
local https = require "ssl.https"
http.TIMEOUT = 10
local r,s,h = https.request({
url = url,
method = "GET",
sink = ltn12.sink.table(results),
headers = {
["Cache-Control"] = "no-cache",
["X-Token"] = config.token
}
})