It is highly discouraged to use any of the lua socket apis directly as they will always block your driver’s progress entirely while waiting on IO. In the above example, updating to use the cosock equivalent would be the ideal
local cosock = require "cosock"
local http = cosock.asyncify "socket.http"
-- ...