Skip to content

Commit d21253d

Browse files
committed
Don't use go for blocking io
1 parent fef6bea commit d21253d

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/neovim_client/rpc.clj

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@
1717
"Read messages from the input stream, put them on a channel."
1818
[input-stream]
1919
(let [chan (async/chan 1024)]
20-
;; TODO make these threads w/ loops, since they're handling IO
21-
;; might explain the wierd drlog blockages
22-
(async/go-loop
23-
[]
24-
(when-let [msg (msgpack/unpack input-stream)]
25-
(log/info "stream -> msg -> in chan: " msg)
26-
(async/>! chan msg)
27-
(recur)))
20+
(async/thread
21+
(loop []
22+
(when-let [msg (msgpack/unpack input-stream)]
23+
(log/info "stream -> msg -> in chan: " msg)
24+
(async/>!! chan msg)
25+
(recur))))
2826
chan))
2927

3028
(defn- write-msg!
@@ -37,12 +35,12 @@
3735
"Make a channel to read messages from, write to output stream."
3836
[output-stream]
3937
(let [chan (async/chan 1024)]
40-
(async/go-loop
41-
[]
42-
(when-let [msg (async/<! chan)]
43-
(log/info "stream <- msg <- out chan: " msg)
44-
(write-msg! (msgpack/pack msg) output-stream)
45-
(recur)))
38+
(async/thread
39+
(loop []
40+
(when-let [msg (async/<!! chan)]
41+
(log/info "stream <- msg <- out chan: " msg)
42+
(write-msg! (msgpack/pack msg) output-stream)
43+
(recur))))
4644
chan))
4745

4846
;; ***** Public *****

0 commit comments

Comments
 (0)