diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-11 21:56:46 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-11 21:56:46 +0800 |
commit | 566f367c6f3846015c6d2b5df2f113faf68e1326 (patch) | |
tree | 203c7370d47701b9a54a3e775b553c81969c3319 /server | |
parent | df1f80df28b48ea5976e1b33e5705d76ff66b667 (diff) | |
download | lua-language-server-566f367c6f3846015c6d2b5df2f113faf68e1326.zip |
计时器不在和真实时间关联,避免计时器任务耗时过长造成的堵塞
Diffstat (limited to 'server')
-rw-r--r-- | server/src/service.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/server/src/service.lua b/server/src/service.lua index 88c42fda..508c135d 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -808,17 +808,17 @@ function mt:listen() local clock = os.clock() while true do local startClock = os.clock() + local delta = os.clock() - clock async.onTick() self:onTick() - local delta = os.clock() - clock - clock = os.clock() local suc, err = xpcall(updateTimer, log.error, delta) if not suc then io.stderr:write(err) io.stderr:flush() end + clock = os.clock() local passedClock = os.clock() - startClock if passedClock > 0.1 then thread.sleep(0.0) |