Skip to content

Commit 5e17509

Browse files
read-loop into different Thread pool
1 parent 63bd432 commit 5e17509

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/docker.clj

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@
228228

229229
(defn inspect-image [{:keys [Name Id]}]
230230
(curl/get
231-
(format "http://localhost/images/%s/json" (or Name Id))
231+
(format "http://localhost/images/%s/json" (or Name Id))
232232
{:raw-args ["--unix-socket" "/var/run/docker.sock"]
233233
:throw false}))
234234

@@ -547,10 +547,13 @@
547547
(let [header-buf (ByteBuffer/allocate 8)
548548
stdout (PipedOutputStream.)
549549
stdout-reader (io/reader (PipedInputStream. stdout))]
550-
(async/go-loop []
551-
(when-let [line (.readLine stdout-reader)]
552-
(async/put! c {:stdout line})
553-
(recur)))
550+
(.start ^Thread
551+
(Thread.
552+
(fn []
553+
(loop []
554+
(when-let [line (.readLine stdout-reader)]
555+
(async/put! c {:stdout line})
556+
(recur))))))
554557
(loop [offset 0]
555558
(let [result (.read ^SocketChannel in header-buf)]
556559
(cond
@@ -656,7 +659,10 @@
656659
c (async/chan)
657660
output-channel (async/chan)]
658661
(start x)
659-
(async/thread (read-loop socket-channel c))
662+
(.start ^Thread
663+
(Thread.
664+
(fn []
665+
(read-loop socket-channel c))))
660666
(async/go
661667
(docker/wait x)
662668
(async/>! c :stopped)

0 commit comments

Comments
 (0)