From 57dc5a9c742bfd1b2b238c94101dbc2a712f0a02 Mon Sep 17 00:00:00 2001 From: Robin Gower Date: Mon, 17 May 2021 14:10:31 +0200 Subject: [PATCH] Ensure query input stream is closed when spilling subject URIs to disk --- src/ook/etl.clj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ook/etl.clj b/src/ook/etl.clj index 12a6cd1..b0c04e9 100644 --- a/src/ook/etl.clj +++ b/src/ook/etl.clj @@ -82,8 +82,9 @@ (try ;; write results to tempfile cache (let [client (interceptors/accept client "text/csv")] - (with-open [os (io/output-stream cache-file)] - (io/copy (io/input-stream (query client query-string)) os))) + (with-open [cache (io/output-stream cache-file) + result (io/input-stream (query client query-string))] + (io/copy result cache))) ;; read results from tempfile cache (let [rdr (io/reader cache-file) var-name (.readLine rdr)