I am using core.async with Om and a websocket. I use channels to communicate 
changes to a parent go block in IWillMount for om/update! and om/transact! and 
I also use a channel to handle incoming responses from a websocket.

I get quite a bit of data pushed onto these channels, sometimes a thousand puts 
per seconds on each. I can run my app fine for many minutes with considerable 
updates and there is no problem: the channels and Om respond as advertised.

Eventually, however, everything stops with the console message:

Uncaught Error: Assert failed: No more than 1024 pending puts are allowed on a 
single channel.

(I also found a similar unanswered SO question here: 
http://stackoverflow.com/questions/24753884/no-more-than-1024-pending-put-on-a-single-channel)

I am aware of what this message means but not sure what would cause it unless 
the infinite go loop in IWillMount stops doing its thing. Now, I came across 
this:

https://twitter.com/swannodette/status/456131778781396992

Noteable info from that exchange: "run into issues if there are pending puts 
when initiate the go block...[no] problem if start with channel reads [first]."

I can expect I might have puts onto a channel before Om first starts reading 
them, so should I consider doing something more than a mere go loop in 
IWillMount? I have something like this now:

(defn watch-root
  "The invisible parent root that monitors all state changes from core.async 
channels and then builds the actual interface in main-root."
  [app owner]
  (reify
    om/IWillMount
    (will-mount [this]
               (go (while true
                     (let [t (<! state/chan-om-transact)]
                       #_(println t)
                       (apply om/transact! app t))))
               (go (while true
                     (let [u (<! state/chan-om-update)]
                       #_(println u)
                       (apply om/update! app u)))))
    om/IRender
    (render [this]
      (om/build main-root app))))

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to