fix(inferium-harvester): better error handling for fetchRemotePlan
This commit is contained in:
parent
9bd5bbc127
commit
b8fb2390f2
@ -280,15 +280,19 @@ local function fetchRemotePlan()
|
|||||||
local replyMessage, errMessage = net.sendQuery(INFERIUM_SERVER, message, NETWORK_TIMEOUT)
|
local replyMessage, errMessage = net.sendQuery(INFERIUM_SERVER, message, NETWORK_TIMEOUT)
|
||||||
if replyMessage and replyMessage.payload then
|
if replyMessage and replyMessage.payload then
|
||||||
previouslyFetchedRemotePlan = replyMessage.payload
|
previouslyFetchedRemotePlan = replyMessage.payload
|
||||||
|
print('> plan fetched')
|
||||||
return replyMessage.payload
|
return replyMessage.payload
|
||||||
elseif previouslyFetchedRemotePlan then
|
elseif previouslyFetchedRemotePlan then
|
||||||
print('> failed to fetch remote plan, use the previous one instead')
|
print('> failed to fetch: ' .. tostring(errMessage))
|
||||||
|
print('> use the previous recorded remote plan instead')
|
||||||
return previouslyFetchedRemotePlan
|
return previouslyFetchedRemotePlan
|
||||||
elseif not replyMessage and errMessage then
|
elseif not replyMessage and errMessage then
|
||||||
if lastErrMessage ~= errMessage then
|
if lastErrMessage ~= errMessage then
|
||||||
lastErrMessage = errMessage
|
lastErrMessage = errMessage
|
||||||
print('> failed to fetch: ' .. tostring(errMessage))
|
print('> failed to fetch: ' .. tostring(errMessage))
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
error('unknown error during fetch')
|
||||||
end
|
end
|
||||||
|
|
||||||
os.sleep(IDLE_TIME)
|
os.sleep(IDLE_TIME)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user