mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
plugin: Prevent HTTP timeout cascading after session stop
This commit is contained in:
parent
6f1469a551
commit
b2c515f2e6
2 changed files with 13 additions and 3 deletions
|
|
@ -82,11 +82,16 @@ function ApiContext.new(baseUrl)
|
|||
__baseUrl = baseUrl,
|
||||
__serverId = nil,
|
||||
__messageCursor = -1,
|
||||
__connected = true,
|
||||
}
|
||||
|
||||
return setmetatable(self, ApiContext)
|
||||
end
|
||||
|
||||
function ApiContext:disconnect()
|
||||
self.__connected = false
|
||||
end
|
||||
|
||||
function ApiContext:connect()
|
||||
local url = ("%s/api/rojo"):format(self.__baseUrl)
|
||||
|
||||
|
|
@ -132,7 +137,7 @@ function ApiContext:retrieveMessages()
|
|||
local function sendRequest()
|
||||
return Http.get(url)
|
||||
:catch(function(err)
|
||||
if err.type == Http.Error.Kind.Timeout then
|
||||
if err.type == Http.Error.Kind.Timeout and self.__connected then
|
||||
return sendRequest()
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue