fix runaway CPU usage when nrepl connected

This commit is contained in:
Jeremy Penner 2023-01-14 22:31:53 -05:00
parent 1bcea81f43
commit a7dd68bd32

View file

@ -96,7 +96,7 @@
(local (port host) (values (or opt.port 7888) (or opt.host :localhost))) (local (port host) (values (or opt.port 7888) (or opt.host :localhost)))
(set self.connection (assert (socket.connect host port))) (set self.connection (assert (socket.connect host port)))
(self.connection:settimeout 0) (self.connection:settimeout 0)
(core.add_thread #(while true (self:receive) (coroutine.yield)) self) (core.add_thread #(while true (self:receive) (coroutine.yield 0.1)) self)
(self:send {:op :clone} (self:send {:op :clone}
{:new-session #(do (set self.default-session $2) {:new-session #(do (set self.default-session $2)
(when opt.on-connect (opt.on-connect self)))}))) (when opt.on-connect (opt.on-connect self)))})))