From 7fecb0732ce36b2e6246b5fd85ca298e00a79e2b Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sun, 5 Jan 2025 19:24:08 +0100 Subject: [PATCH] fix #3714 --- changelog.md | 3 ++- .../assets/opencomputers/loot/openos/lib/event.lua | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 7aed87005a..841864bda6 100644 --- a/changelog.md +++ b/changelog.md @@ -9,8 +9,9 @@ ## OpenOS fixes/improvements +* [#3714] Fix an OpenOS 1.8.0 regression causing event.pullFiltered() to effectively ignore filter timeouts. * [#3727] Fix an exception handler bug in process.lua, uncovered by fixing recursive xpcall() handling in 1.8.4. ## List of contributors -asie, charagarland, HfSr, Timothé GRISOT +asie, charagarland, DragDen, HfSr, Timothé GRISOT diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/event.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/event.lua index d216979d65..1ad8b46981 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/event.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/event.lua @@ -140,8 +140,13 @@ function event.pullFiltered(...) filter = args[2] end + local deadline = computer.uptime() + (seconds or math.huge) repeat - local signal = table.pack(computer.pullSignal(seconds)) + local waitTime = deadline - computer.uptime() + if waitTime <= 0 then + break + end + local signal = table.pack(computer.pullSignal(waitTime)) if signal.n > 0 then if not (seconds or filter) or filter == nil or filter(table.unpack(signal, 1, signal.n)) then return table.unpack(signal, 1, signal.n)