diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2024-04-18 17:17:27 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2024-04-18 17:17:27 +0800 |
commit | 3767771e8371ae837106e9885de2ce851165cf1b (patch) | |
tree | a274ea3e46c0ff0f6972475f034c6fbb72e6c173 | |
parent | d11925853f6dd02ae5684a587257fd9b29202771 (diff) | |
download | lua-language-server-3767771e8371ae837106e9885de2ce851165cf1b.zip |
每个线程只进行一次update
-rw-r--r-- | script/brave/work.lua | 2 | ||||
-rw-r--r-- | script/proto/proto.lua | 7 | ||||
-rw-r--r-- | script/service/service.lua | 4 |
3 files changed, 4 insertions, 9 deletions
diff --git a/script/brave/work.lua b/script/brave/work.lua index 0514d1e2..cdba955e 100644 --- a/script/brave/work.lua +++ b/script/brave/work.lua @@ -54,7 +54,7 @@ brave.on('loadProtoBySocket', function (param) function lsmaster:on_data(data) lsclient:write(data) - net.update() + --net.update() end while true do diff --git a/script/proto/proto.lua b/script/proto/proto.lua index 01ff8238..78400f97 100644 --- a/script/proto/proto.lua +++ b/script/proto/proto.lua @@ -55,7 +55,6 @@ function m.send(data) io.write(buf) elseif m.mode == 'socket' then m.client:write(buf) - net.update() end end @@ -258,15 +257,9 @@ function m.listen(mode, socketPort) } m.client = dummyClient - local t = timer.loop(0.1, function () - net.update() - end) - function server:on_accepted(client) - t:remove() m.client = client client:write(dummyClient.buf) - net.update() end pub.task('loadProtoBySocket', { diff --git a/script/service/service.lua b/script/service/service.lua index 2c19b4f6..c3afd4cf 100644 --- a/script/service/service.lua +++ b/script/service/service.lua @@ -12,6 +12,7 @@ local ws = require 'workspace' local time = require 'bee.time' local fw = require 'filewatch' local furi = require 'file-uri' +local net = require 'service.net' require 'jsonc' require 'json-beautify' @@ -168,6 +169,7 @@ function m.eventLoop() end local function doSomething() + net.update() timer.update() pub.step(false) if await.step() then @@ -180,7 +182,7 @@ function m.eventLoop() local function sleep() idle() for _ = 1, 10 do - thread.sleep(100) + net.update(100) if doSomething() then return end |