Fix timeout issue for real this time

This commit is contained in:
Lucien Greathouse
2019-01-28 14:55:56 -08:00
parent e5d3204b6c
commit c6766bbe77

View File

@@ -140,14 +140,18 @@ end
function ApiContext:retrieveMessages() function ApiContext:retrieveMessages()
local url = ("%s/api/subscribe/%s"):format(self.baseUrl, self.messageCursor) local url = ("%s/api/subscribe/%s"):format(self.baseUrl, self.messageCursor)
return Http.get(url) local function sendRequest()
:catch(function(err) return Http.get(url)
if err.type == HttpError.Error.Timeout then :catch(function(err)
return Http.get(url) if err.type == HttpError.Error.Timeout then
end return sendRequest()
end
return Promise.reject(err) return Promise.reject(err)
end) end)
end
return sendRequest()
:andThen(rejectFailedRequests) :andThen(rejectFailedRequests)
:andThen(function(response) :andThen(function(response)
local body = response:json() local body = response:json()