diff --git a/backend/src/app/util/async.clj b/backend/src/app/util/async.clj index a0492e086..984cbb167 100644 --- a/backend/src/app/util/async.clj +++ b/backend/src/app/util/async.clj @@ -81,7 +81,11 @@ (recur (a/timeout max-batch-age) init))) (nil? val) - (a/close! out) + (if (empty? buf) + (a/close! out) + (do + (a/offer! out [:timeout buf]) + (a/close! out))) (identical? port in) (let [buf (conj buf val)] @@ -91,3 +95,7 @@ (recur (a/timeout max-batch-age) init)) (recur tch buf)))))) out)) + +(defn thread-sleep + [ms] + (Thread/sleep ms))