From f724a6ec6963346c12256205803d34aac9d7a928 Mon Sep 17 00:00:00 2001 From: Mike Blume Date: Wed, 1 Jan 2014 02:03:54 +0000 Subject: [PATCH] fix stream2es memleak this prevents *all of a customer's index data* from being held in the heap at once. --- src/stream2es/stream/es.clj | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/stream2es/stream/es.clj b/src/stream2es/stream/es.clj index e5de22f..92b4d7d 100644 --- a/src/stream2es/stream/es.clj +++ b/src/stream2es/stream/es.clj @@ -61,12 +61,9 @@ (defn make-callback [opts handler] (fn [] - (doall - (map handler - (concat - (map make-doc - (es/scan (:source opts) + (doseq [doc (es/scan (:source opts) (:query opts) (:scroll-time opts) - (:scroll-size opts))) - [:eof]))))) + (:scroll-size opts))] + (handler (make-doc doc))) + (handler :eof)))