-
-
Notifications
You must be signed in to change notification settings - Fork 87
Closed
Labels
Description
I was testing a websocket client for a service I'm hosting locally right now. I forgot to start said service before testing my client and noticed no errors, but that the lua process was using a lot of CPU resources.
Here is my connect function:
function connect(node)
node.socket = websocket.new_from_uri(node.config.wss)
node.socket.request.headers:upsert("user-agent", USER_AGENT)
node.socket.request.headers:upsert("authorization", node.config.password)
node.socket.request.headers:upsert("num-shards", tostring(tointeger(node.link.shards)))
node.socket.request.headers:upsert("user-id", tostring(node.link.user_id))
logger.info("%s will now connect", node)
local success, str, err = node.socket:connect(3) --- This line blocks the coroutine forever and cqueues starts to use a lot of resources
if not success then -- expected it to reach here
return logger.error("%s had an error while connecting (%s - %q, %q)", node, errno[err], errno.strerror(err), str or "")
else
node.connected = true
node.link.loop:wrap(messages, node)
logger.info("%s connected", node)
end
endIn this scenario I would expect an ECONNREFUSED.
I would note that my lua process is being run currently from a wsl session while I test locally and that
the service is hosted "outside" on windows.