mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 22:25:26 +00:00
Fix bug where HTTP being disabled would cause stickiness
This commit is contained in:
@@ -97,10 +97,10 @@ function ApiContext:connect()
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.serverId = body.serverId
|
self.serverId = body.serverId
|
||||||
self.connected = true
|
|
||||||
self.partitionRoutes = body.partitions
|
self.partitionRoutes = body.partitions
|
||||||
self.rootInstanceId = body.rootInstanceId
|
self.rootInstanceId = body.rootInstanceId
|
||||||
self.instanceMetadataMap = body.instanceMetadataMap
|
self.instanceMetadataMap = body.instanceMetadataMap
|
||||||
|
self.connected = true
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ function App:render()
|
|||||||
startSession = function(address, port)
|
startSession = function(address, port)
|
||||||
Logging.trace("Starting new session")
|
Logging.trace("Starting new session")
|
||||||
|
|
||||||
self.currentSession = Session.new({
|
local success, session = Session.new({
|
||||||
address = address,
|
address = address,
|
||||||
port = port,
|
port = port,
|
||||||
onError = function()
|
onError = function()
|
||||||
@@ -100,9 +100,12 @@ function App:render()
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
self:setState({
|
if success then
|
||||||
sessionStatus = SessionStatus.Connected,
|
self.currentSession = session
|
||||||
})
|
self:setState({
|
||||||
|
sessionStatus = SessionStatus.Connected,
|
||||||
|
})
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
cancel = function()
|
cancel = function()
|
||||||
Logging.trace("Canceling session configuration")
|
Logging.trace("Canceling session configuration")
|
||||||
|
|||||||
@@ -72,4 +72,4 @@ function Http.jsonDecode(source)
|
|||||||
return HttpService:JSONDecode(source)
|
return HttpService:JSONDecode(source)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Http
|
return Http
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
local Selection = game:GetService("Selection")
|
|
||||||
local HttpService = game:GetService("HttpService")
|
|
||||||
|
|
||||||
local Logging = require(script.Parent.Logging)
|
local Logging = require(script.Parent.Logging)
|
||||||
|
|
||||||
local HttpError = {}
|
local HttpError = {}
|
||||||
@@ -70,10 +67,6 @@ end
|
|||||||
|
|
||||||
function HttpError:report()
|
function HttpError:report()
|
||||||
Logging.warn(self.message)
|
Logging.warn(self.message)
|
||||||
|
|
||||||
if self.type == HttpError.Error.HttpNotEnabled then
|
|
||||||
Selection:Set(HttpService)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return HttpError
|
return HttpError
|
||||||
@@ -10,6 +10,8 @@ function Session.new(config)
|
|||||||
|
|
||||||
self.onError = config.onError
|
self.onError = config.onError
|
||||||
|
|
||||||
|
local hasErrors = false
|
||||||
|
|
||||||
local reconciler
|
local reconciler
|
||||||
|
|
||||||
local remoteUrl = ("http://%s:%s"):format(config.address, config.port)
|
local remoteUrl = ("http://%s:%s"):format(config.address, config.port)
|
||||||
@@ -36,6 +38,7 @@ function Session.new(config)
|
|||||||
return reconciler:applyUpdate(requestedIds, response.instances)
|
return reconciler:applyUpdate(requestedIds, response.instances)
|
||||||
end)
|
end)
|
||||||
:catch(function(message)
|
:catch(function(message)
|
||||||
|
hasErrors = true
|
||||||
Logging.warn("%s", tostring(message))
|
Logging.warn("%s", tostring(message))
|
||||||
self.onError()
|
self.onError()
|
||||||
end)
|
end)
|
||||||
@@ -52,11 +55,12 @@ function Session.new(config)
|
|||||||
return api:retrieveMessages()
|
return api:retrieveMessages()
|
||||||
end)
|
end)
|
||||||
:catch(function(message)
|
:catch(function(message)
|
||||||
|
hasErrors = true
|
||||||
Logging.warn("%s", tostring(message))
|
Logging.warn("%s", tostring(message))
|
||||||
self.onError()
|
self.onError()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return setmetatable(self, Session)
|
return not hasErrors, setmetatable(self, Session)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Session
|
return Session
|
||||||
Reference in New Issue
Block a user