Client message receive and send go-loops never stop
Closed this issue · 1 comments
codonnell commented
The go-loops at https://github.com/gizmo385/discord.clj/blob/master/src/discord/client.clj#L63-L78 need to check for when their respective channels have been closed to stop recurring. As it is now, once these channels are closed, the go-loops will take nil values forever. To verify the behavior, you can do this at the repl:
=> (require '[clojure.core.async :as a])
nil
=> (def c (a/chan))
#'discord.core/c
=> (a/go-loop [] (let [v (a/<! c)] (println v) (recur)))
#object[clojure.core.async.impl.channels.ManyToManyChannel 0x55d32427 "clojure.core.async.impl.channels.ManyToManyChannel@55d32427"]
=> (a/>!! c "hello")
hello
true
=> (a/close! c)
nil
nil
nil
...
I'll put up a PR with what I think is a reasonable fix. Appreciate the work you've put into this project!
gizmo385 commented
@codonnell fixed this in #6