chore(inferium-harvester): better debug messages

This commit is contained in:
Guillaume ARM 2024-05-21 23:41:43 +02:00
parent 6071fdb6b4
commit 97bb32b544

View File

@ -274,16 +274,20 @@ local function fetchRemotePlan()
print('> fetch remote plan') print('> fetch remote plan')
local message = { type = 'getplan' } local message = { type = 'getplan' }
while true do local lastErrMessage = nil
local replyMessage, _ = net.sendQuery(INFERIUM_SERVER, message, NETWORK_TIMEOUT)
print('> fetched')
while true do
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
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 remote plan, use the previous one instead')
return previouslyFetchedRemotePlan return previouslyFetchedRemotePlan
elseif not replyMessage and errMessage then
if lastErrMessage ~= errMessage then
print('> failed to fetch: ' .. tostring(errMessage))
end
end end
os.sleep(IDLE_TIME) os.sleep(IDLE_TIME)