diff --git a/inventoryManager.lua b/inventoryManager.lua index 9d9424f..db44f3a 100644 --- a/inventoryManager.lua +++ b/inventoryManager.lua @@ -646,7 +646,6 @@ local function main() local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message") if channel == cfg.ORDER_CHANNEL and type(message) == "table" then table.insert(networkQueue, { replyChannel = replyChannel, message = message }) - os.queueEvent("network_queued") end end end), @@ -658,7 +657,7 @@ local function main() end while true do if #networkQueue == 0 then - os.pullEvent("network_queued") + sleep(0) end while #networkQueue > 0 do local entry = table.remove(networkQueue, 1) diff --git a/manager/operations.lua b/manager/operations.lua index 5002d93..6b57b86 100644 --- a/manager/operations.lua +++ b/manager/operations.lua @@ -1338,7 +1338,6 @@ function O.craftItem(recipeIdx, batches) log.info("CRAFT", "Waiting for turtle reply (timeout: %ds)...", cfg.CRAFT_TIMEOUT) local deadline = os.clock() + cfg.CRAFT_TIMEOUT local result = nil - local bufferedMessages = {} while os.clock() < deadline do local timerId = os.startTimer(math.max(0.1, deadline - os.clock())) @@ -1350,18 +1349,13 @@ function O.craftItem(recipeIdx, batches) if channel == cfg.CRAFT_REPLY_CHANNEL and type(message) == "table" and message.type == "craft_result" then result = message break - elseif channel == cfg.ORDER_CHANNEL then - table.insert(bufferedMessages, {event, p1, p2, p3, p4, p5}) end + -- ORDER_CHANNEL messages are captured by the Network-capture task elseif event == "timer" and p1 == timerId then -- Timeout tick end end - for _, msg in ipairs(bufferedMessages) do - os.queueEvent(table.unpack(msg)) - end - activity.crafting = false state.needsRedraw = true state.smelterNeedsRedraw = true