Fork me on GitHub
#core-async
<
2017-06-13
>
tianshu15:06:14

Hi, Is it possible to interrupt this loop?

(go 
  (while true
     (try 
       (<! ch)
       ...
       (catch Exception ex
         ...))))
I have code like this, but it's likely the loop will stop after a few time. ch is a (chan (dropping-buffer 1)), when the loop is stopped, I can get the item in ch with (<!! ch). And there's no error log(even though I logged in catch clause). So I wondering in which situation the loop will stop.

hiredman15:06:05

how do you know it "stops"? does the ... have any other channel operations? what version of core.async are you using? before 0.3.426 exception handling was pretty broken

tianshu15:06:20

version of core.async in [org.clojure/core.async "0.3.442"]. why I think it stops is that, there's no log printed, I have log inside try block. and when log disappear, I can use (<!! ch) consume the item in channel.

hiredman15:06:20

but what is in the "..." could it be blocked publishing to a downstream channel?

tianshu15:06:24

Yes, you,re right, there's a parking take inside. I shoud add more log to see if there's any problem.