summaryrefslogtreecommitdiff
path: root/script/brave/brave.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/brave/brave.lua')
-rw-r--r--script/brave/brave.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/script/brave/brave.lua b/script/brave/brave.lua
index 5a15a6b2..34c92a72 100644
--- a/script/brave/brave.lua
+++ b/script/brave/brave.lua
@@ -1,5 +1,6 @@
local channel = require 'bee.channel'
local select = require 'bee.select'
+local thread = require 'bee.thread'
local function channel_init(chan)
local selector = select.create()
@@ -9,11 +10,14 @@ end
local function channel_bpop(ctx)
local selector, chan = ctx[1], ctx[2]
- for _ in selector:wait() do
- local r = table.pack(chan:pop())
- if r[1] == true then
- return table.unpack(r, 2)
+ while true do
+ for _ in selector:wait() do
+ local r = table.pack(chan:pop())
+ if r[1] == true then
+ return table.unpack(r, 2)
+ end
end
+ thread.sleep(10)
end
end