From 97bb32b54400d67a873c1d9db7d19f100b5ddc68 Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Tue, 21 May 2024 23:41:43 +0200 Subject: [PATCH] chore(inferium-harvester): better debug messages --- inferium-harvester.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/inferium-harvester.lua b/inferium-harvester.lua index 0827817..87785ad 100644 --- a/inferium-harvester.lua +++ b/inferium-harvester.lua @@ -274,16 +274,20 @@ local function fetchRemotePlan() print('> fetch remote plan') local message = { type = 'getplan' } - while true do - local replyMessage, _ = net.sendQuery(INFERIUM_SERVER, message, NETWORK_TIMEOUT) - print('> fetched') + local lastErrMessage = nil + while true do + local replyMessage, errMessage = net.sendQuery(INFERIUM_SERVER, message, NETWORK_TIMEOUT) if replyMessage and replyMessage.payload then previouslyFetchedRemotePlan = replyMessage.payload return replyMessage.payload elseif previouslyFetchedRemotePlan then print('> failed to fetch remote plan, use the previous one instead') return previouslyFetchedRemotePlan + elseif not replyMessage and errMessage then + if lastErrMessage ~= errMessage then + print('> failed to fetch: ' .. tostring(errMessage)) + end end os.sleep(IDLE_TIME)