Skip to content

Commit 7fecb07

Browse files
committed
fix #3714
1 parent e8595d2 commit 7fecb07

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99

1010
## OpenOS fixes/improvements
1111

12+
* [#3714] Fix an OpenOS 1.8.0 regression causing event.pullFiltered() to effectively ignore filter timeouts.
1213
* [#3727] Fix an exception handler bug in process.lua, uncovered by fixing recursive xpcall() handling in 1.8.4.
1314

1415
## List of contributors
1516

16-
asie, charagarland, HfSr, Timothé GRISOT
17+
asie, charagarland, DragDen, HfSr, Timothé GRISOT

src/main/resources/assets/opencomputers/loot/openos/lib/event.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,13 @@ function event.pullFiltered(...)
140140
filter = args[2]
141141
end
142142

143+
local deadline = computer.uptime() + (seconds or math.huge)
143144
repeat
144-
local signal = table.pack(computer.pullSignal(seconds))
145+
local waitTime = deadline - computer.uptime()
146+
if waitTime <= 0 then
147+
break
148+
end
149+
local signal = table.pack(computer.pullSignal(waitTime))
145150
if signal.n > 0 then
146151
if not (seconds or filter) or filter == nil or filter(table.unpack(signal, 1, signal.n)) then
147152
return table.unpack(signal, 1, signal.n)

0 commit comments

Comments
 (0)