Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
blocks until data is available on the trailers channel
Browse files Browse the repository at this point in the history
  • Loading branch information
shamsimam committed Apr 17, 2019
1 parent 70109b5 commit ef581db
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/clj/qbits/jet/util.clj
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@
(defn trailers-ch->supplier
[trailers-ch]
(when trailers-ch
(let [trailers-atom (atom {})]
(async/go
(when-let [trailers (async/<! trailers-ch)]
(reset! trailers-atom trailers)))
(reify Supplier
(get [_] (map->http-fields @trailers-atom))))))
(reify Supplier
(get [_]
(let [trailers (or (async/<!! trailers-ch) {})]
(map->http-fields trailers))))))

0 comments on commit ef581db

Please sign in to comment.