Review comment: make a large-ish dropping buffer for JS listen! consumers.
This commit is contained in:
parent
032bfafec2
commit
a4dd7e4e9c
1 changed files with 8 additions and 4 deletions
|
@ -648,8 +648,9 @@
|
||||||
(a/tap (:listener-mult conn) listener-sink)
|
(a/tap (:listener-mult conn) listener-sink)
|
||||||
listener-sink)
|
listener-sink)
|
||||||
|
|
||||||
(defn- -listen-chan [f]
|
(defn- -listen-chan
|
||||||
(let [c (a/chan (a/sliding-buffer 10))]
|
[f n]
|
||||||
|
(let [c (a/chan (a/dropping-buffer n))]
|
||||||
(go-loop []
|
(go-loop []
|
||||||
(when-let [v (<! c)]
|
(when-let [v (<! c)]
|
||||||
(do
|
(do
|
||||||
|
@ -664,8 +665,11 @@
|
||||||
|
|
||||||
Returns the channel listened to, for future calls to `unlisten-chan!`."
|
Returns the channel listened to, for future calls to `unlisten-chan!`."
|
||||||
([conn f]
|
([conn f]
|
||||||
{:pre [(fn? f)]}
|
;; Decently large buffer before dropping, for JS consumers.
|
||||||
(listen-chan! conn (-listen-chan f))))
|
(listen! conn f 1024))
|
||||||
|
([conn f n]
|
||||||
|
{:pre [(fn? f) (pos? n)]}
|
||||||
|
(listen-chan! conn (-listen-chan f n))))
|
||||||
|
|
||||||
(defn unlisten-chan! [conn listener-sink]
|
(defn unlisten-chan! [conn listener-sink]
|
||||||
"Stop putting reports successfully transacted against the given connection onto the given channel."
|
"Stop putting reports successfully transacted against the given connection onto the given channel."
|
||||||
|
|
Loading…
Reference in a new issue