Yep that was a mistake on my part, actually the code isn't exactly like
that. I wrap the (chan) inside a function and then in go-loop I invoke that
function.


On 18 July 2014 10:37, Andrew Stoeckley <[email protected]> wrote:

> Faris -- I just tried the code you mentioned and it prints 0 1 2 3 4
> ... as anyone would expect. I can't imagine why you are seeing 0 3 7
> 10 as there is surely more going on there on your side, because that
> is not what should be happening.
>
> On Fri, Jul 18, 2014 at 10:16 AM, Faris Nasution
> <[email protected]> wrote:
> > Not om related, but I did simple experiment:
> >
> > (def counter (atom 0))
> >
> > (def my-chan (chan))
> >
> > (.setInterval js/window
> >                   (fn []
> >                     (put! my-chan @counter)
> >                     (swap! counter inc)) 1000)
> >
> > (go (while true
> >         (let [value (<! my-chan)]
> >           (.log js/console value))))
> >
> > While I guess it would print 0 1 2 3 4 and so on, it prints 0 3  7 10.
> So I
> > guess there are pending/untaken value, that makes the channel complain.
> >
> >
> > On 18 July 2014 07:44, Andrew Stoeckley <[email protected]> wrote:
> >>
> >> Hi William, the takes off the channel are happening in IWillMount
> >> (posted in my original message), however, the puts onto the channel
> >> are not happening in the React lifecycle. They are happening
> >> separately as a result of websocket messages incoming. My puts look
> >> like this:
> >>
> >>  (defn websocket-handler-example [id]
> >> (put! state/chan-om-transact [[:cursor :nested-cursor] #(conj % id)]))
> >>
> >> And then they are read from in the "watch-root" function I posted
> earlier.
> >>
> >> Perhaps the problem is that my channels are not both written to and
> >> read from within the React lifecycle?
> >>
> >> Everything seems to go fine -- for awhile. Within a few minutes of
> >> this fast activity, eventually I get the error about pending puts on
> >> the channel.
> >>
> >> On Fri, Jul 18, 2014 at 4:29 AM, William Sommers <
> [email protected]>
> >> wrote:
> >> > Could you post the repo or the code where the channels are being used?
> >> >
> >> > It looks like you might be putting things on a channel within the
> >> > IRender lifecycle hook which will happen once each time there is a
> state
> >> > change.
> >> >
> >> > Will
> >> >
> >> > --
> >> > Note that posts from new members are moderated - please be patient
> with
> >> > your first post.
> >> > ---
> >> > You received this message because you are subscribed to a topic in the
> >> > Google Groups "ClojureScript" group.
> >> > To unsubscribe from this topic, visit
> >> >
> https://groups.google.com/d/topic/clojurescript/iwTKqy_6YJo/unsubscribe.
> >> > To unsubscribe from this group and all its topics, 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.
> >>
> >> --
> >> 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.
> >
> >
> > --
> > Note that posts from new members are moderated - please be patient with
> your
> > first post.
> > ---
> > You received this message because you are subscribed to a topic in the
> > Google Groups "ClojureScript" group.
> > To unsubscribe from this topic, visit
> > https://groups.google.com/d/topic/clojurescript/iwTKqy_6YJo/unsubscribe.
> > To unsubscribe from this group and all its topics, 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.
>
> --
> 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.
>

-- 
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