Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/utils/connectivity_check.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local socket = require("socket")
local connectivity_check = {}

function connectivity_check.is_backend_online()
-- Attempt to open a socket connection to Render backend api
local connection = socket.tcp()
connection:settimeout(2) -- 2 seconds timeout
local success, err = connection:connect("zync-pd9r.onrender.com", 80)
if success then
connection:close()
return true
else
return false
end
end

return connectivity_check
Loading