summaryrefslogtreecommitdiff
path: root/script/brave
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-11-02 14:59:45 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-11-02 14:59:45 +0800
commit98c4293062d0e2ef0e7a80179fd27ea586094bcf (patch)
treee8b1919b7c0886c5297ad0c41fd5938a15f2ed68 /script/brave
parent07d37e7b5d4fd1841dbc3fdfb5b17759f2f79baf (diff)
downloadlua-language-server-98c4293062d0e2ef0e7a80179fd27ea586094bcf.zip
shelve
Diffstat (limited to 'script/brave')
-rw-r--r--script/brave/brave.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/script/brave/brave.lua b/script/brave/brave.lua
index f07fb00f..9ad7ebd1 100644
--- a/script/brave/brave.lua
+++ b/script/brave/brave.lua
@@ -42,22 +42,23 @@ end
--- 开始找工作
function m.start(privatePad)
- local myPad = privatePad and thread.channel('private:' .. privatePad) or taskPad
+ local reqPad = privatePad and thread.channel('req:' .. privatePad) or taskPad
+ local resPad = privatePad and thread.channel('res:' .. privatePad) or waiter
m.push('mem', collectgarbage 'count')
while true do
- local name, id, params = myPad:bpop()
+ local name, id, params = reqPad:bpop()
local ability = m.ability[name]
-- TODO
if not ability then
- waiter:push(m.id, id)
+ resPad:push(m.id, id)
log.error('Brave can not handle this work: ' .. name)
goto CONTINUE
end
local ok, res = xpcall(ability, log.error, params)
if ok then
- waiter:push(m.id, id, res)
+ resPad:push(m.id, id, res)
else
- waiter:push(m.id, id)
+ resPad:push(m.id, id)
end
m.push('mem', collectgarbage 'count')
::CONTINUE::